Answering to Rick Measham (Fri, 8 Aug 2003 10:29:08 +1000) >At 4:13 PM -0700 7/8/03, Matthew McGillis wrote: [snip] > >Casey offers a better solution for the problem you describe, however >you *could* (as apposed to should) also do the following (not the >safest thing to do, but it works): > >In your own code put something like: > *DateTime::format_how_I_want = sub { > # method to turn the datetime in $_[0] into the string you need > } > >Then in Class::DBI you can use: > DateTime->format_how_I_want(); > >Once again, let me say (because if I don't, Dave will) that this is >not recommended behaviour. It's not a good thing to play around >inside other module's namespaces. >
Why not use subclassing? A few days ago, I attended M-J.D.'s talks in YAPC::Europe in Paris, and in one of them he just advised something like that. You do not play around somebody else's namespace, you reuse it to make your own namespace. When you remove all the buzzwords, OO is just a few good ideas, and subclassing is one of them. Jean Forget -- And now we have the World Wide Web (the only thing I know of whose shortened form --- www --- takes three times longer to say than what itıs short for). -- Douglas Adams, the Salmon of Doubt