AutoSplit(3) Perl Programmers Reference Guide AutoSplit(3) NAME AutoSplit - split(1,n) a package for autoloading SYNOPSIS autosplit($file(1,n), $dir, $keep, $check, $modtime); autosplit_lib_modules(@modules); DESCRIPTION This function will split(1,n) up your program into files that the AutoLoader module can handle. It is used by both the standard perl libraries and by the MakeMaker utility, to automatically configure libraries for autoloading. The "autosplit" interface splits the specified file(1,n) into a hierarchy rooted at the directory $dir. It creates directories as needed to reflect class hierarchy, and creates the file(1,n) autosplit.ix. This file(1,n) acts as both forward declaration of all package routines, and as time- stamp for the last update(7,n) of the hierarchy. The remaining three arguments to "autosplit" govern other options to the autosplitter. $keep If the third argument, $keep, is false, then any pre-existing "*.al" files in(1,8) the autoload directory are removed if(3,n) they are no longer part of the module (obsoleted functions). $keep defaults to 0. $check The fourth argument, $check, instructs "autosplit" to check the mod- ule currently being split(1,n) to ensure that it includes a "use" specifi- cation for the AutoLoader module, and skips the module if(3,n) AutoLoader is not detected. $check defaults to 1. $modtime Lastly, the $modtime argument specifies that "autosplit" is to check the modification time(1,2,n) of the module against that of the "autosplit.ix" file(1,n), and only split(1,n) the module if(3,n) it is newer. $mod- time(1,2,n) defaults to 1. Typical use of AutoSplit in(1,8) the perl MakeMaker utility is via the com- mand-line with: perl -e 'use AutoSplit; autosplit($ARGV[0], $ARGV[1], 0, 1, 1)' Defined as a Make macro, it is invoked with file(1,n) and directory argu- ments; "autosplit" will split(1,n) the specified file(1,n) into the specified directory and delete obsolete ".al" files, after checking first that the module does use the AutoLoader, and ensuring that the module is not already currently split(1,n) in(1,8) its current form (the modtime test). The "autosplit_lib_modules" form is used in(1,8) the building of perl. It takes as input a list of files (modules) that are assumed to reside in(1,8) a directory lib relative to the current directory. Each file(1,n) is sent to the autosplitter one at a time(1,2,n), to be split(1,n) into the directory lib/auto(5,8). In both usages of the autosplitter, only subroutines defined following the perl __END__ token are split(1,n) out into separate files. Some routines may be placed prior to this marker to force their immediate loading and parsing. Multiple packages As of version(1,3,5) 1.01 of the AutoSplit module it is possible to have mul- tiple packages within a single file. Both of the following cases are supported: package NAME; __END__ sub AAA { ... } package NAME::option1; sub BBB { ... } package NAME::option2; sub BBB { ... } package NAME; __END__ sub AAA { ... } sub NAME::option1::BBB { ... } sub NAME::option2::BBB { ... } DIAGNOSTICS "AutoSplit" will inform the user if(3,n) it is necessary to create the top- level directory specified in(1,8) the invocation. It is preferred that the script or installation process that invokes "AutoSplit" have created the full directory path ahead of time. This warning may indicate that the module is being split(1,n) into an incorrect path. "AutoSplit" will warn the user of all subroutines whose name causes potential file(1,n) naming conflicts on machines with drastically limited (8 characters or less(1,3)) file(1,n) name length. Since the subroutine name is used as the file(1,n) name, these warnings can aid in(1,8) portability to such sys- tems. Warnings are issued and the file(1,n) skipped if(3,n) "AutoSplit" cannot locate either the __END__ marker or a "package Name;"-style specification. "AutoSplit" will also emit general diagnostics for inability to create directories or files. perl v5.8.5 2001-09-21 AutoSplit(3)