Stas Bekman wrote: [...]
really, I think it should always be only one matching module, since we have no internal sub-classing at the moment.
Something like so:
package ModPerl::EazyLife;
use ModPerl::MethodLookup (); use Carp;
my @avail_modules = ModPerl::MethodLookup::avail_modules();
push @avail_modules, 'Apache'; # XXX: may go away
my $skip = qr|(::)?DESTROY$|;
for my $module (@avail_modules) {
*{"$module\::AUTOLOAD"} = sub {
my($hint, @modules) =
ModPerl::MethodLookup::lookup_method($AUTOLOAD, @_); # there should be only one match
if (my $module = @modules) {
eval "require $module";
# use the function from the module that we have just loaded
$AUTOLOAD =~ s/.*::/$module::/;
goto &$AUTOLOAD;
}
else {
return if $AUTOLOAD =~ /$skip/;
croak $hint || "Can't find $AUTOLOAD";
}
};
}1;
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
