|Perl Monk, Perl Meditation|
Re: Creating packages on the flyby Gilimanjaro (Hermit)
|on Jun 06, 2006 at 13:38 UTC||Need Help??|
I would think that a UNIVERSAL::AUTOLOAD method would be the only way to catch this, if you want to avoid any predefinitions...
Another approach maybe to find all Wx:: classes and subclass them at startup... This may subclass a whole bunch of classes that you won't be using, but it avoids AUTOLOAD nastiness... Something like the following maybe:
This code doesn't recurse (so only packages directly in the Wx:: namespace will be subclassed) and it only works if the packages in that namespace have already been use'd. But that could be done automatically I suppose...
But perhaps it would then make more sense to generate them specifically for the packages you want to subclass using a syntax like:
That would reduce the duplicate code you'd be typing, prevent redundant subclassing and avoid UNIVERSAL::AUTOLOAD;
(All code untested; just brainstorming here...)