Delays the loading of functions until
they are used. Each function is placed in a file that
has the same name as the function, with an
.al
extension.
The files are stored in a subdirectory of the
auto/
directory
that is named after the package. For example, the function
GoodStuff::whatever
is loaded from the file
auto/GoodStuff/whatever.al
. Should always be
use
d and not
require
d.
A module using the AutoLoader has the special
marker
__END__
prior to the declarations for the subroutine to be autoloaded. Any code
before this
marker is loaded and compiled when the module is used, but at
the marker, Perl stops parsing the file.
Later, during execution, when a subroutine that isn't
yet in memory is called, the
AUTOLOAD
function attempts to
find it in a directory relative to the location of the module file.
For example, if
POSIX.pm
is in the directory
/usr/local/lib/perl5
, then the AutoLoader looks for
POSIX subroutines in
/usr/local/lib/perl5/auto/POSIX/*.al
.