| Next | Tricks of the Wizards | 103 |
sub closethewindow { ... }
sub AUTOLOAD {
my ($package, $func) = ($AUTOLOAD =~ /(.*)::(.*)/);
my $true_func = join '::', $package, lc $func;
if (defined &$true_func) {
*$AUTOLOAD = \&$true_func;
goto &$AUTOLOAD;
}
croak "Undefined subroutine &$AUTOLOAD";
}
First time we call CloseTheWindow, alias the two function names
Second time, we get CloseTheWindow directly
There's that magic glob again
goto &$AUTOLOAD and *$AUTOLOAD = ... are common idioms
| Next | ![]() |
Copyright © 2003 M. J. Dominus |