|Pathologically Eclectic Rubbish Lister|
Creating packages on the flyby Jouke (Curate)
|on Jun 06, 2006 at 08:27 UTC||Need Help??|
Jouke has asked for the
wisdom of the Perl Monks concerning the following question:
Dear Brothers and Sisters,
Most of you probably know the AUTOLOAD mechanism, where we can handle subroutines that are not explicitly defined. I want something similar for entire packages. Let me explain in a little more detail what I want to achieve and why:
I want to build something that subclasses each and every class that Wx defines. I could of course create many packages by hand and make them subclasses of the specific Wx:: subclass. However, apart from it being a time-intensive job, each subclass I create would do almost the same (I don't like to write the same code multiple times), and apart from that, if there's a new version of Wx that has a new class that I don't handle yet, I have to release a new version.
Therefore I want to ask you if you see a possibility to let me create one package (Foo) in such a way, that if I call Foo::Bar->new() (where Foo::Bar isn't defined explicitly), it defines Foo::Bar on the fly and let me do the magic that I want with it.
Any suggestion is appreciated, even if it doesn't fully do what I want...
Using Perl to enable the disabled: pVoice