NYCPHP Meetup

NYPHP.org

[nycphp-talk] Class name conflict with Pear Pager

Daniel Convissor danielc at analysisandsolutions.com
Thu Sep 13 21:04:56 EDT 2007


On Thu, Sep 13, 2007 at 06:27:51PM -0400, Cliff Hirsch wrote:
> Shana Tovah:
> 
> I have a class called Pager. Bad name. This conflicts with Pear Pager. It is
> used in a zilion places so changing the name would be a pain. Not a big
> deal, but a pain. To date, I have just been deleting or renaming the Pear
> Pager class,

That's crazy.  Rename your class and be done with it.  It's such an easy 
fix.  One way:

* Either use grep or your favorite text editor to open all files that 
refer to either Pager class.  For example, using cygwin on windows:

grep -rlE 'new Pager|new YourFakePearPagerName' . | xargs -i ep {} &

(replacing ep at the end with the name of your editor)


* Search and replace in all files YourFakePearPagerName with 
XXXTempPgrName

* Search and replace in all files Pager with NewNameForYourPagerClass

* Finally search and replace XXXTempPgrName with Pager.

* Save all files.

It took me longer to write this email than it would have taken to solve 
the problem once and for all.

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409



More information about the talk mailing list