Install Perl 5.8.8
[msysgit.git] / mingw / html / pod / perlmodinstall.html
blob38fbaededbd5d108cc21b8a81304626c960039da
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>perlmodinstall - Installing CPAN Modules</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;perlmodinstall - Installing CPAN Modules</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="#description">DESCRIPTION</a></li>
24 <ul>
26 <li><a href="#preamble">PREAMBLE</a></li>
27 </ul>
29 <li><a href="#portability">PORTABILITY</a></li>
30 <li><a href="#hey">HEY</a></li>
31 <li><a href="#author">AUTHOR</a></li>
32 <li><a href="#copyright">COPYRIGHT</a></li>
33 </ul>
34 <!-- INDEX END -->
36 <hr />
37 <p>
38 </p>
39 <h1><a name="name">NAME</a></h1>
40 <p>perlmodinstall - Installing CPAN Modules</p>
41 <p>
42 </p>
43 <hr />
44 <h1><a name="description">DESCRIPTION</a></h1>
45 <p>You can think of a module as the fundamental unit of reusable Perl
46 code; see <a href="file://C|\msysgit\mingw\html/pod/perlmod.html">the perlmod manpage</a> for details. Whenever anyone creates a chunk of
47 Perl code that they think will be useful to the world, they register
48 as a Perl developer at <a href="http://www.cpan.org/modules/04pause.html">http://www.cpan.org/modules/04pause.html</a>
49 so that they can then upload their code to the CPAN. The CPAN is the
50 Comprehensive Perl Archive Network and can be accessed at
51 <a href="http://www.cpan.org/">http://www.cpan.org/</a> , and searched at <a href="http://search.cpan.org/">http://search.cpan.org/</a> .</p>
52 <p>This documentation is for people who want to download CPAN modules
53 and install them on their own computer.</p>
54 <p>
55 </p>
56 <h2><a name="preamble">PREAMBLE</a></h2>
57 <p>First, are you sure that the module isn't already on your system? Try
58 <code>perl -MFoo -e 1</code>. (Replace ``Foo'' with the name of the module; for
59 instance, <code>perl -MCGI::Carp -e 1</code>.</p>
60 <p>If you don't see an error message, you have the module. (If you do
61 see an error message, it's still possible you have the module, but
62 that it's not in your path, which you can display with <code>perl -e
63 &quot;print qq(@INC)&quot;</code>.) For the remainder of this document, we'll assume
64 that you really honestly truly lack an installed module, but have
65 found it on the CPAN.</p>
66 <p>So now you have a file ending in .tar.gz (or, less often, .zip). You
67 know there's a tasty module inside. There are four steps you must now
68 take:</p>
69 <dl>
70 <dt><strong><a name="item_decompress_the_file"><strong>DECOMPRESS</strong> the file</a></strong>
72 <dt><strong><a name="item_unpack_the_file_into_a_directory"><strong>UNPACK</strong> the file into a directory</a></strong>
74 <dt><strong><a name="item_module"><strong>BUILD</strong> the module (sometimes unnecessary)</a></strong>
76 <dt><strong><a name="item_install_the_module_2e"><strong>INSTALL</strong> the module.</a></strong>
78 </dl>
79 <p>Here's how to perform each step for each operating system. This is
80 &lt;not&gt; a substitute for reading the README and INSTALL files that
81 might have come with your module!</p>
82 <p>Also note that these instructions are tailored for installing the
83 module into your system's repository of Perl modules -- but you can
84 install modules into any directory you wish. For instance, where I
85 say <code>perl Makefile.PL</code>, you can substitute <code>perl Makefile.PL
86 PREFIX=/my/perl_directory</code> to install the modules into
87 <code>/my/perl_directory</code>. Then you can use the modules from your Perl
88 programs with <code>use lib &quot;/my/perl_directory/lib/site_perl&quot;;</code> or
89 sometimes just <code>use &quot;/my/perl_directory&quot;;</code>. If you're on a system
90 that requires superuser/root access to install modules into the
91 directories you see when you type <code>perl -e &quot;print qq(@INC)&quot;</code>, you'll
92 want to install them into a local directory (such as your home
93 directory) and use this approach.</p>
94 <ul>
95 <li>
96 <p><strong>If you're on a Unix or Unix-like system,</strong></p>
97 <p>You can use Andreas Koenig's CPAN module
98 ( <a href="http://www.cpan.org/modules/by-module/CPAN">http://www.cpan.org/modules/by-module/CPAN</a> )
99 to automate the following steps, from DECOMPRESS through INSTALL.</p>
100 <p>A. DECOMPRESS</p>
101 <p>Decompress the file with <code>gzip -d yourmodule.tar.gz</code></p>
102 <p>You can get gzip from <a href="ftp://prep.ai.mit.edu/pub/gnu/">ftp://prep.ai.mit.edu/pub/gnu/</a></p>
103 <p>Or, you can combine this step with the next to save disk space:</p>
104 <pre>
105 gzip -dc yourmodule.tar.gz | tar -xof -</pre>
106 <p>B. UNPACK</p>
107 <p>Unpack the result with <code>tar -xof yourmodule.tar</code></p>
108 <p>C. BUILD</p>
109 <p>Go into the newly-created directory and type:</p>
110 <pre>
111 perl Makefile.PL
112 make test</pre>
113 <p>or</p>
114 <pre>
115 perl Makefile.PL PREFIX=/my/perl_directory</pre>
116 <p>to install it locally. (Remember that if you do this, you'll have to
117 put <code>use lib &quot;/my/perl_directory&quot;;</code> near the top of the program that
118 is to use this module.</p>
119 <p>D. INSTALL</p>
120 <p>While still in that directory, type:</p>
121 <pre>
122 make install</pre>
123 <p>Make sure you have the appropriate permissions to install the module
124 in your Perl 5 library directory. Often, you'll need to be root.</p>
125 <p>That's all you need to do on Unix systems with dynamic linking.
126 Most Unix systems have dynamic linking -- if yours doesn't, or if for
127 another reason you have a statically-linked perl, <strong>and</strong> the
128 module requires compilation, you'll need to build a new Perl binary
129 that includes the module. Again, you'll probably need to be root.</p>
130 </li>
131 <li>
132 <p><strong>If you're running ActivePerl (Win95/98/2K/NT/XP, Linux, Solaris)</strong></p>
133 <p>First, type <code>ppm</code> from a shell and see whether ActiveState's PPM
134 repository has your module. If so, you can install it with <code>ppm</code> and
135 you won't have to bother with any of the other steps here. You might
136 be able to use the CPAN instructions from the ``Unix or Linux'' section
137 above as well; give it a try. Otherwise, you'll have to follow the
138 steps below.</p>
139 <pre>
140 A. DECOMPRESS</pre>
141 <p>You can use the shareware Winzip ( <a href="http://www.winzip.com">http://www.winzip.com</a> ) to
142 decompress and unpack modules.</p>
143 <pre>
144 B. UNPACK</pre>
145 <p>If you used WinZip, this was already done for you.</p>
146 <pre>
147 C. BUILD</pre>
148 <p>You'll need the <code>nmake</code> utility, available at
149 <a href="http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe">http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/nmake15.exe</a>
150 or dmake, available on CPAN.
151 <a href="http://search.cpan.org/dist/dmake/">http://search.cpan.org/dist/dmake/</a></p>
152 <p>Does the module require compilation (i.e. does it have files that end
153 in .xs, .c, .h, .y, .cc, .cxx, or .C)? If it does, life is now
154 officially tough for you, because you have to compile the module
155 yourself -- no easy feat on Windows. You'll need a compiler such as
156 Visual C++. Alternatively, you can download a pre-built PPM package
157 from ActiveState.
158 <a href="http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/">http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/</a></p>
159 <p>Go into the newly-created directory and type:</p>
160 <pre>
161 perl Makefile.PL
162 nmake test</pre>
163 <pre>
164 D. INSTALL</pre>
165 <p>While still in that directory, type:</p>
166 <pre>
167 nmake install</pre>
168 </li>
169 <li>
170 <p><strong>If you're using a Macintosh with ``Classic'' MacOS and MacPerl,</strong></p>
171 <p>A. DECOMPRESS</p>
172 <p>First, make sure you have the latest <strong>cpan-mac</strong> distribution (
173 <a href="http://www.cpan.org/authors/id/CNANDOR/">http://www.cpan.org/authors/id/CNANDOR/</a> ), which has utilities for
174 doing all of the steps. Read the cpan-mac directions carefully and
175 install it. If you choose not to use cpan-mac for some reason, there
176 are alternatives listed here.</p>
177 <p>After installing cpan-mac, drop the module archive on the
178 <strong>untarzipme</strong> droplet, which will decompress and unpack for you.</p>
179 <p><strong>Or</strong>, you can either use the shareware <strong>StuffIt Expander</strong> program
180 ( <a href="http://www.aladdinsys.com/expander/">http://www.aladdinsys.com/expander/</a> )
181 in combination with <strong>DropStuff with Expander Enhancer</strong>
182 ( <a href="http://www.aladdinsys.com/dropstuff/">http://www.aladdinsys.com/dropstuff/</a> )
183 or the freeware <strong>MacGzip</strong> program (
184 <a href="http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html">http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html</a> ).</p>
185 <p>B. UNPACK</p>
186 <p>If you're using untarzipme or StuffIt, the archive should be extracted
187 now. <strong>Or</strong>, you can use the freeware <strong>suntar</strong> or <em>Tar</em> (
188 <a href="http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/">http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/</a> ).</p>
189 <p>C. BUILD</p>
190 <p>Check the contents of the distribution.
191 Read the module's documentation, looking for
192 reasons why you might have trouble using it with MacPerl. Look for
193 <em>.xs</em> and <em>.c</em> files, which normally denote that the distribution
194 must be compiled, and you cannot install it ``out of the box.''
195 (See <a href="#portability">PORTABILITY</a>.)</p>
196 <p>If a module does not work on MacPerl but should, or needs to be
197 compiled, see if the module exists already as a port on the
198 MacPerl Module Porters site ( <a href="http://pudge.net/mmp/">http://pudge.net/mmp/</a> ).
199 For more information on doing XS with MacPerl yourself, see
200 Arved Sandstrom's XS tutorial ( <a href="http://macperl.com/depts/Tutorials/">http://macperl.com/depts/Tutorials/</a> ),
201 and then consider uploading your binary to the CPAN and
202 registering it on the MMP site.</p>
203 <p>D. INSTALL</p>
204 <p>If you are using cpan-mac, just drop the folder on the
205 <strong>installme</strong> droplet, and use the module.</p>
206 <p><strong>Or</strong>, if you aren't using cpan-mac, do some manual labor.</p>
207 <p>Make sure the newlines for the modules are in Mac format, not Unix format.
208 If they are not then you might have decompressed them incorrectly. Check
209 your decompression and unpacking utilities settings to make sure they are
210 translating text files properly.</p>
211 <p>As a last resort, you can use the perl one-liner:</p>
212 <pre>
213 perl -i.bak -pe 's/(?:\015)?\012/\015/g' &lt;filenames&gt;</pre>
214 <p>on the source files.</p>
215 <p>Then move the files (probably just the <em>.pm</em> files, though there
216 may be some additional ones, too; check the module documentation)
217 to their final destination: This will
218 most likely be in <code>$ENV{MACPERL}site_lib:</code> (i.e.,
219 <code>HD:MacPerl folder:site_lib:</code>). You can add new paths to
220 the default <a href="file://C|\msysgit\mingw\html/pod/perlvar.html#item__inc"><code>@INC</code></a> in the Preferences menu item in the
221 MacPerl application (<code>$ENV{MACPERL}site_lib:</code> is added
222 automagically). Create whatever directory structures are required
223 (i.e., for <code>Some::Module</code>, create
224 <code>$ENV{MACPERL}site_lib:Some:</code> and put
225 <code>Module.pm</code> in that directory).</p>
226 <p>Then run the following script (or something like it):</p>
227 <pre>
228 #!perl -w
229 use AutoSplit;
230 my $dir = &quot;${MACPERL}site_perl&quot;;
231 autosplit(&quot;$dir:Some:Module.pm&quot;, &quot;$dir:auto&quot;, 0, 1, 1);</pre>
232 </li>
233 <li>
234 <p><strong>If you're on the DJGPP port of DOS,</strong></p>
235 <pre>
236 A. DECOMPRESS</pre>
237 <p>djtarx ( <a href="ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/">ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/</a> )
238 will both uncompress and unpack.</p>
239 <pre>
240 B. UNPACK</pre>
241 <p>See above.</p>
242 <pre>
243 C. BUILD</pre>
244 <p>Go into the newly-created directory and type:</p>
245 <pre>
246 perl Makefile.PL
247 make test</pre>
248 <p>You will need the packages mentioned in <em>README.dos</em>
249 in the Perl distribution.</p>
250 <pre>
251 D. INSTALL</pre>
252 <p>While still in that directory, type:</p>
253 <pre>
254 make install</pre>
255 <p>You will need the packages mentioned in <em>README.dos</em> in the Perl distribution.</p>
256 </li>
257 <li>
258 <p><strong>If you're on OS/2,</strong></p>
259 <p>Get the EMX development suite and gzip/tar, from either Hobbes (
260 <a href="http://hobbes.nmsu.edu">http://hobbes.nmsu.edu</a> ) or Leo ( <a href="http://www.leo.org">http://www.leo.org</a> ), and then follow
261 the instructions for Unix.</p>
262 </li>
263 <li>
264 <p><strong>If you're on VMS,</strong></p>
265 <p>When downloading from CPAN, save your file with a <code>.tgz</code>
266 extension instead of <code>.tar.gz</code>. All other periods in the
267 filename should be replaced with underscores. For example,
268 <code>Your-Module-1.33.tar.gz</code> should be downloaded as
269 <code>Your-Module-1_33.tgz</code>.</p>
270 <p>A. DECOMPRESS</p>
271 <p>Type</p>
272 <pre>
273 gzip -d Your-Module.tgz</pre>
274 <p>or, for zipped modules, type</p>
275 <pre>
276 unzip Your-Module.zip</pre>
277 <p>Executables for gzip, zip, and VMStar:</p>
278 <pre>
279 <a href="http://www.openvms.digital.com/freeware/">http://www.openvms.digital.com/freeware/</a>
280 <a href="http://www.crinoid.com/utils/">http://www.crinoid.com/utils/</a></pre>
281 <p>and their source code:</p>
282 <pre>
283 <a href="http://www.fsf.org/order/ftp.html">http://www.fsf.org/order/ftp.html</a></pre>
284 <p>Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip
285 package. The former is a simple compression tool; the latter permits
286 creation of multi-file archives.</p>
287 <p>B. UNPACK</p>
288 <p>If you're using VMStar:</p>
289 <pre>
290 VMStar xf Your-Module.tar</pre>
291 <p>Or, if you're fond of VMS command syntax:</p>
292 <pre>
293 tar/extract/verbose Your_Module.tar</pre>
294 <p>C. BUILD</p>
295 <p>Make sure you have MMS (from Digital) or the freeware MMK ( available
296 from MadGoat at <a href="http://www.madgoat.com">http://www.madgoat.com</a> ). Then type this to create
297 the DESCRIP.MMS for the module:</p>
298 <pre>
299 perl Makefile.PL</pre>
300 <p>Now you're ready to build:</p>
301 <pre>
302 mms test</pre>
303 <p>Substitute <code>mmk</code> for <code>mms</code> above if you're using MMK.</p>
304 <p>D. INSTALL</p>
305 <p>Type</p>
306 <pre>
307 mms install</pre>
308 <p>Substitute <code>mmk</code> for <code>mms</code> above if you're using MMK.</p>
309 </li>
310 <li>
311 <p><strong>If you're on MVS</strong>,</p>
312 <p>Introduce the <em>.tar.gz</em> file into an HFS as binary; don't translate from
313 ASCII to EBCDIC.</p>
314 <p>A. DECOMPRESS</p>
315 <p>Decompress the file with <code>gzip -d yourmodule.tar.gz</code></p>
316 <p>You can get gzip from
317 <a href="http://www.s390.ibm.com/products/oe/bpxqp1.html">http://www.s390.ibm.com/products/oe/bpxqp1.html</a></p>
318 <p>B. UNPACK</p>
319 <p>Unpack the result with</p>
320 <pre>
321 pax -o to=IBM-1047,from=ISO8859-1 -r &lt; yourmodule.tar</pre>
322 <p>The BUILD and INSTALL steps are identical to those for Unix. Some
323 modules generate Makefiles that work better with GNU make, which is
324 available from <a href="http://www.mks.com/s390/gnu/">http://www.mks.com/s390/gnu/</a></p>
325 </li>
326 </ul>
328 </p>
329 <hr />
330 <h1><a name="portability">PORTABILITY</a></h1>
331 <p>Note that not all modules will work with on all platforms.
332 See <a href="file://C|\msysgit\mingw\html/pod/perlport.html">the perlport manpage</a> for more information on portability issues.
333 Read the documentation to see if the module will work on your
334 system. There are basically three categories
335 of modules that will not work ``out of the box'' with all
336 platforms (with some possibility of overlap):</p>
337 <ul>
338 <li>
339 <p><strong>Those that should, but don't.</strong> These need to be fixed; consider
340 contacting the author and possibly writing a patch.</p>
341 </li>
342 <li>
343 <p><strong>Those that need to be compiled, where the target platform
344 doesn't have compilers readily available.</strong> (These modules contain
345 <em>.xs</em> or <em>.c</em> files, usually.) You might be able to find
346 existing binaries on the CPAN or elsewhere, or you might
347 want to try getting compilers and building it yourself, and then
348 release the binary for other poor souls to use.</p>
349 </li>
350 <li>
351 <p><strong>Those that are targeted at a specific platform.</strong>
352 (Such as the Win32:: modules.) If the module is targeted
353 specifically at a platform other than yours, you're out
354 of luck, most likely.</p>
355 </li>
356 </ul>
357 <p>Check the CPAN Testers if a module should work with your platform
358 but it doesn't behave as you'd expect, or you aren't sure whether or
359 not a module will work under your platform. If the module you want
360 isn't listed there, you can test it yourself and let CPAN Testers know,
361 you can join CPAN Testers, or you can request it be tested.</p>
362 <pre>
363 <a href="http://testers.cpan.org/">http://testers.cpan.org/</a></pre>
365 </p>
366 <hr />
367 <h1><a name="hey">HEY</a></h1>
368 <p>If you have any suggested changes for this page, let me know. Please
369 don't send me mail asking for help on how to install your modules.
370 There are too many modules, and too few Orwants, for me to be able to
371 answer or even acknowledge all your questions. Contact the module
372 author instead, or post to comp.lang.perl.modules, or ask someone
373 familiar with Perl on your operating system.</p>
375 </p>
376 <hr />
377 <h1><a name="author">AUTHOR</a></h1>
378 <p>Jon Orwant</p>
379 <p><a href="mailto:orwant@medita.mit.edu">orwant@medita.mit.edu</a></p>
380 <p>with invaluable help from Chris Nandor, and valuable help from Brandon
381 Allbery, Charles Bailey, Graham Barr, Dominic Dunlop, Jarkko
382 Hietaniemi, Ben Holzman, Tom Horsley, Nick Ing-Simmons, Tuomas
383 J. Lukka, Laszlo Molnar, Alan Olsen, Peter Prymmer, Gurusamy Sarathy,
384 Christoph Spalinger, Dan Sugalski, Larry Virden, and Ilya Zakharevich.</p>
385 <p>First version July 22, 1998; last revised November 21, 2001.</p>
387 </p>
388 <hr />
389 <h1><a name="copyright">COPYRIGHT</a></h1>
390 <p>Copyright (C) 1998, 2002, 2003 Jon Orwant. All Rights Reserved.</p>
391 <p>Permission is granted to make and distribute verbatim copies of this
392 documentation provided the copyright notice and this permission notice are
393 preserved on all copies.</p>
394 <p>Permission is granted to copy and distribute modified versions of this
395 documentation under the conditions for verbatim copying, provided also
396 that they are marked clearly as modified versions, that the authors'
397 names and title are unchanged (though subtitles and additional
398 authors' names may be added), and that the entire resulting derived
399 work is distributed under the terms of a permission notice identical
400 to this one.</p>
401 <p>Permission is granted to copy and distribute translations of this
402 documentation into another language, under the above conditions for
403 modified versions.</p>
404 <table border="0" width="100%" cellspacing="0" cellpadding="3">
405 <tr><td class="block" style="background-color: #cccccc" valign="middle">
406 <big><strong><span class="block">&nbsp;perlmodinstall - Installing CPAN Modules</span></strong></big>
407 </td></tr>
408 </table>
410 </body>
412 </html>