Book HomeJava and XSLTSearch this book

8.6. AutoSplit

Splits a program or module into files that the AutoLoader can handle. It can be called from a program or from the command line:

# From a program
use AutoSplit;
autosplit_modules(@ARGV)

# From the command line
perl -MAutoSplit -e 'autosplit(FILE, DIR, KEEP, CHECK, MODTIME)' ... 

# Another interface
perl -MAutoSplit -e 'autosplit_lib_modules(@ARGV)' ...

AutoSplit is used by MakeMaker as well as by the standard Perl libraries. It operates on a file, splitting off subroutines that come after the _ _END_ _ marker and storing them as described above for AutoLoader, creating any necessary directories along the way. AutoSplit has two functions.

autosplit

autosplit (file, dir, keep, check, modtime)

Splits the module into files. Each file is given the name of the subroutine it contains, with .al appended. autosplit also creates the file autosplit.ix, which serves as both a forward declaration of all package routines and as a timestamp showing when the hierarchy was last updated. Takes the following arguments:

file
Filename of program or module to be split.

dir
Name of directory hierarchy in which to store the split files.

keep
If false, preexisting .al files in the auto directory that are no longer part of the module are deleted.

check
If true, checks to be sure the module being split includes a use AutoLoader statement. If the statement is missing, autosplit doesn't process the module.

modtime
If true, splits the module only if it is newer than autosplit.ix.

autosplit_lib_modules

autosplit_lib_modules (@ARGV)

Takes a list of modules that are assumed to be in a lib subdirectory of the current directory, processes them as described above for autosplit, and stores the resulting file in the directory lib/auto. Used in building Perl.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.