1AutoSplit(3pm) Perl Programmers Reference Guide AutoSplit(3pm)
2
3
4
6 AutoSplit - split a package for autoloading
7
9 autosplit($file, $dir, $keep, $check, $modtime);
10
11 autosplit_lib_modules(@modules);
12
14 This function will split up your program into files that the AutoLoader
15 module can handle. It is used by both the standard perl libraries and
16 by the MakeMaker utility, to automatically configure libraries for
17 autoloading.
18
19 The "autosplit" interface splits the specified file into a hierarchy
20 rooted at the directory $dir. It creates directories as needed to
21 reflect class hierarchy, and creates the file autosplit.ix. This file
22 acts as both forward declaration of all package routines, and as time‐
23 stamp for the last update of the hierarchy.
24
25 The remaining three arguments to "autosplit" govern other options to
26 the autosplitter.
27
28 $keep
29 If the third argument, $keep, is false, then any pre-existing "*.al"
30 files in the autoload directory are removed if they are no longer
31 part of the module (obsoleted functions). $keep defaults to 0.
32
33 $check
34 The fourth argument, $check, instructs "autosplit" to check the mod‐
35 ule currently being split to ensure that it includes a "use" specifi‐
36 cation for the AutoLoader module, and skips the module if AutoLoader
37 is not detected. $check defaults to 1.
38
39 $modtime
40 Lastly, the $modtime argument specifies that "autosplit" is to check
41 the modification time of the module against that of the
42 "autosplit.ix" file, and only split the module if it is newer. $mod‐
43 time defaults to 1.
44
45 Typical use of AutoSplit in the perl MakeMaker utility is via the com‐
46 mand-line with:
47
48 perl -e 'use AutoSplit; autosplit($ARGV[0], $ARGV[1], 0, 1, 1)'
49
50 Defined as a Make macro, it is invoked with file and directory argu‐
51 ments; "autosplit" will split the specified file into the specified
52 directory and delete obsolete ".al" files, after checking first that
53 the module does use the AutoLoader, and ensuring that the module is not
54 already currently split in its current form (the modtime test).
55
56 The "autosplit_lib_modules" form is used in the building of perl. It
57 takes as input a list of files (modules) that are assumed to reside in
58 a directory lib relative to the current directory. Each file is sent to
59 the autosplitter one at a time, to be split into the directory
60 lib/auto.
61
62 In both usages of the autosplitter, only subroutines defined following
63 the perl __END__ token are split out into separate files. Some routines
64 may be placed prior to this marker to force their immediate loading and
65 parsing.
66
67 Multiple packages
68
69 As of version 1.01 of the AutoSplit module it is possible to have mul‐
70 tiple packages within a single file. Both of the following cases are
71 supported:
72
73 package NAME;
74 __END__
75 sub AAA { ... }
76 package NAME::option1;
77 sub BBB { ... }
78 package NAME::option2;
79 sub BBB { ... }
80
81 package NAME;
82 __END__
83 sub AAA { ... }
84 sub NAME::option1::BBB { ... }
85 sub NAME::option2::BBB { ... }
86
88 "AutoSplit" will inform the user if it is necessary to create the top-
89 level directory specified in the invocation. It is preferred that the
90 script or installation process that invokes "AutoSplit" have created
91 the full directory path ahead of time. This warning may indicate that
92 the module is being split into an incorrect path.
93
94 "AutoSplit" will warn the user of all subroutines whose name causes
95 potential file naming conflicts on machines with drastically limited (8
96 characters or less) file name length. Since the subroutine name is used
97 as the file name, these warnings can aid in portability to such sys‐
98 tems.
99
100 Warnings are issued and the file skipped if "AutoSplit" cannot locate
101 either the __END__ marker or a "package Name;"-style specification.
102
103 "AutoSplit" will also emit general diagnostics for inability to create
104 directories or files.
105
106
107
108perl v5.8.8 2001-09-21 AutoSplit(3pm)