L0rdPhi1 has asked for the wisdom of the Perl Monks concerning the following question:
sub AUTOLOAD { # Filter out package information. (my $name = $AUTOLOAD) =~ s/.*:://; if (exists $subs{$name}) { *$AUTOLOAD = sub {$subs{$name}}; # This wont work! why? eval "sub $AUTOLOAD {$subs{$name}}"; # this will... fatalError("A compile error occurred while compiling the subro +utine $AUTOLOAD: $@") if $@; } else { fatalError("The undefined subroutine $AUTOLOAD was called."); } delete $subs{$name}; goto &$AUTOLOAD; }
Edit kudra, 2002-05-27 s/pre/code/, new title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: autoload
by chromatic (Archbishop) on May 27, 2002 at 06:03 UTC | |
|
Re: autoload
by Juerd (Abbot) on May 27, 2002 at 07:19 UTC | |
|
Re: autoload
by strat (Canon) on May 27, 2002 at 10:30 UTC | |
|
Re: autoload
by Anonymous Monk on May 27, 2002 at 05:57 UTC |