1 |
One can define a default function AUTOLOAD to resolve unsatisfied subroutine references in a gibven (set of) packages.
|
2 |
You set up AUTOLOAD to deal with this case in whatever way you want!
|
3 |
AUTOLOAD is passed arguments that went to called subroutine and name of unsatisfied external is in variable $AUTOLOAD
|
4 |
sub AUTOLOAD { # Call UNIX for unsatisfied externals
-
my $program = $AUTOLOAD;
-
$program =~ s/.*:://; # remove any package precursors
-
system($program, @_);
|
5 |
}
|
6 |
date(); # will now just be executed correctly by above AUTOLOAD
|