There's more than one way to do things | |
PerlMonks |
Override *CORE::GLOBAL::require. Is it possible?by cosimo (Hermit) |
on Sep 11, 2008 at 16:44 UTC ( [id://710681]=perlquestion: print w/replies, xml ) | Need Help?? |
cosimo has asked for the wisdom of the Perl Monks concerning the following question: Inspired by adamk at last YAPC::Europe, I'm trying to do an "evil" experiment. I want to change the required module names on the fly. Suppose that I have:
Ok. Now, what I want is to add my own pragma. And if I do this, I want My::Module to be replaced with Another::Module. Something like:
I originally tried with use, but I don't remember why I fell back on require. Anyway, it looks like I can't find a way to properly override CORE::GLOBAL::require to do what I want. Or, is there some other way to achieve this? ... and no, it's not production code, only some experiment ...
Back to
Seekers of Perl Wisdom
|
|