Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / AutoSplit.html
blob5c7f59299dc5c09708623b41ab5da85c2ab47c87
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>AutoSplit - split a package for autoloading</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;AutoSplit - split a package for autoloading</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <ul>
27 <li><a href="#multiple_packages">Multiple packages</a></li>
28 </ul>
30 <li><a href="#diagnostics">DIAGNOSTICS</a></li>
31 </ul>
32 <!-- INDEX END -->
34 <hr />
35 <p>
36 </p>
37 <h1><a name="name">NAME</a></h1>
38 <p>AutoSplit - split a package for autoloading</p>
39 <p>
40 </p>
41 <hr />
42 <h1><a name="synopsis">SYNOPSIS</a></h1>
43 <pre>
44 autosplit($file, $dir, $keep, $check, $modtime);</pre>
45 <pre>
46 autosplit_lib_modules(@modules);</pre>
47 <p>
48 </p>
49 <hr />
50 <h1><a name="description">DESCRIPTION</a></h1>
51 <p>This function will split up your program into files that the AutoLoader
52 module can handle. It is used by both the standard perl libraries and by
53 the MakeMaker utility, to automatically configure libraries for autoloading.</p>
54 <p>The <code>autosplit</code> interface splits the specified file into a hierarchy
55 rooted at the directory <code>$dir</code>. It creates directories as needed to reflect
56 class hierarchy, and creates the file <em>autosplit.ix</em>. This file acts as
57 both forward declaration of all package routines, and as timestamp for the
58 last update of the hierarchy.</p>
59 <p>The remaining three arguments to <code>autosplit</code> govern other options to
60 the autosplitter.</p>
61 <dl>
62 <dt><strong><a name="item__keep">$keep</a></strong>
64 <dd>
65 <p>If the third argument, <em>$keep</em>, is false, then any
66 pre-existing <code>*.al</code> files in the autoload directory are removed if
67 they are no longer part of the module (obsoleted functions).
68 $keep defaults to 0.</p>
69 </dd>
70 </li>
71 <dt><strong><a name="item__check">$check</a></strong>
73 <dd>
74 <p>The
75 fourth argument, <em>$check</em>, instructs <code>autosplit</code> to check the module
76 currently being split to ensure that it includes a <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item_use"><code>use</code></a>
77 specification for the AutoLoader module, and skips the module if
78 AutoLoader is not detected.
79 $check defaults to 1.</p>
80 </dd>
81 </li>
82 <dt><strong><a name="item__modtime">$modtime</a></strong>
84 <dd>
85 <p>Lastly, the <em>$modtime</em> argument specifies
86 that <code>autosplit</code> is to check the modification time of the module
87 against that of the <code>autosplit.ix</code> file, and only split the module if
88 it is newer.
89 $modtime defaults to 1.</p>
90 </dd>
91 </li>
92 </dl>
93 <p>Typical use of AutoSplit in the perl MakeMaker utility is via the command-line
94 with:</p>
95 <pre>
96 perl -e 'use AutoSplit; autosplit($ARGV[0], $ARGV[1], 0, 1, 1)'</pre>
97 <p>Defined as a Make macro, it is invoked with file and directory arguments;
98 <code>autosplit</code> will split the specified file into the specified directory and
99 delete obsolete <code>.al</code> files, after checking first that the module does use
100 the AutoLoader, and ensuring that the module is not already currently split
101 in its current form (the modtime test).</p>
102 <p>The <code>autosplit_lib_modules</code> form is used in the building of perl. It takes
103 as input a list of files (modules) that are assumed to reside in a directory
104 <strong>lib</strong> relative to the current directory. Each file is sent to the
105 autosplitter one at a time, to be split into the directory <strong>lib/auto</strong>.</p>
106 <p>In both usages of the autosplitter, only subroutines defined following the
107 perl <em>__END__</em> token are split out into separate files. Some
108 routines may be placed prior to this marker to force their immediate loading
109 and parsing.</p>
111 </p>
112 <h2><a name="multiple_packages">Multiple packages</a></h2>
113 <p>As of version 1.01 of the AutoSplit module it is possible to have
114 multiple packages within a single file. Both of the following cases
115 are supported:</p>
116 <pre>
117 package NAME;
118 __END__
119 sub AAA { ... }
120 package NAME::option1;
121 sub BBB { ... }
122 package NAME::option2;
123 sub BBB { ... }</pre>
124 <pre>
125 package NAME;
126 __END__
127 sub AAA { ... }
128 sub NAME::option1::BBB { ... }
129 sub NAME::option2::BBB { ... }</pre>
131 </p>
132 <hr />
133 <h1><a name="diagnostics">DIAGNOSTICS</a></h1>
134 <p><code>AutoSplit</code> will inform the user if it is necessary to create the
135 top-level directory specified in the invocation. It is preferred that
136 the script or installation process that invokes <code>AutoSplit</code> have
137 created the full directory path ahead of time. This warning may
138 indicate that the module is being split into an incorrect path.</p>
139 <p><code>AutoSplit</code> will warn the user of all subroutines whose name causes
140 potential file naming conflicts on machines with drastically limited
141 (8 characters or less) file name length. Since the subroutine name is
142 used as the file name, these warnings can aid in portability to such
143 systems.</p>
144 <p>Warnings are issued and the file skipped if <code>AutoSplit</code> cannot locate
145 either the <em>__END__</em> marker or a ``package Name;''-style specification.</p>
146 <p><code>AutoSplit</code> will also emit general diagnostics for inability to
147 create directories or files.</p>
148 <table border="0" width="100%" cellspacing="0" cellpadding="3">
149 <tr><td class="block" style="background-color: #cccccc" valign="middle">
150 <big><strong><span class="block">&nbsp;AutoSplit - split a package for autoloading</span></strong></big>
151 </td></tr>
152 </table>
154 </body>
156 </html>