# from a program
# or from the command line
perl -MAutoSplit -e 'autosplit(
FILE, DIR, KEEP, CHECK, MODTIME
# another interface
perl -MAutoSplit -e 'autosplit_lib_modules(@ARGV)' ...
This function splits up your program or module into files that the
AutoLoader module can handle. It is mainly used to build
autoloading Perl library modules, especially complex ones like POSIX.
It is used by both the standard Perl libraries and by the MakeMaker
module to automatically configure libraries for autoloading.
interface splits the specified
into a hierarchy rooted at the directory
. It creates directories as needed to reflect
class hierarchy. It then creates the file
which acts as both a forward declaration for all package routines and also as a
timestamp for when the hierarchy was last updated.
The remaining three arguments to
options to the autosplitter. If the third argument,
, is false, then any pre-existing
files in the autoload directory are removed if they are
no longer part of the module (obsoleted functions). The fourth argument,
check the module currently being split to ensure that it really does include a
specification for the AutoLoader module,
and skips the module if AutoLoader is not detected. Lastly, the
argument specifies that
is to check the modification time of the module
against that of the
file, and only split the
module if it is newer.
Here's a typical use of AutoSplit by the MakeMaker utility via the
perl -MAutoSplit -e 'autosplit($ARGV, $ARGV, 0, 1, 1)'
MakeMaker defines this
macro, and it is invoked with file and directory
function splits the named file into
the given directory and deletes obsolete
files, after checking
first that the module does use the AutoLoader and ensuring that the module
isn't already split in its current form.
form is used in the building of Perl. It
takes as input a list of files (modules) that are assumed to reside in a
relative to the current directory. Each file is sent
to the autosplitter one at a time, to be split into the directory
In both usages of the autosplitter, only subroutines defined following the
Perl special marker
are split out into separate files.
Routines placed prior to this marker are not autosplit, but are forced to load
when the module is first required.
Currently, AutoSplit cannot handle multiple package specifications
within one file.
AutoSplit will inform the user if it is necessary to create the top-level
directory specified in the invocation. It's better if the script or
installation process that invokes AutoSplit has created the full directory
path ahead of time. This warning may indicate that the module is being split
into an incorrect path.
AutoSplit will also warn the user of subroutines whose names cause potential
naming conflicts on machines with severely limited (eight characters or
less) filename length. Since the subroutine name is used as the filename,
these warnings can aid in portability to such systems.
Warnings are issued and the file skipped if AutoSplit cannot locate
marker or a specification of the form
AutoSplit will also complain if it can't create directories or files.