This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add perlmodinstall, regen perltoc
[perl5.git] / pod / perlmodinstall.pod
CommitLineData
fb9cefb4
GS
1=head1 NAME
2
3perlmodinstall - Installing CPAN Modules
4
5=head1 DESCRIPTION
6
7You can think of a module as the fundamental unit of reusable Perl
8code; see L<perlmod> for details. Whenever anyone creates a chunk of
9Perl code that they think will be useful to the world, they register
10as a Perl developer at http://www.perl.com/CPAN/modules/04pause.html
11so that they can then upload their code to the CPAN. The CPAN is the
12Comprehensive Perl Archive Network and can be accessed at
13http://www.perl.com/CPAN/.
14
15This documentation is for people who want to download CPAN modules
16and install them on their own computer.
17
18=head2 PREAMBLE
19
20You have a file ending in .tar.gz (or, less often, .zip). You know
21there's a tasty module inside. There are four steps you must now
22take:
23
24=over 5
25
26=item B<DECOMPRESS> the file
27=item B<UNPACK> the file into a directory
28=item B<BUILD> the module (sometimes unnecessary)
29=item B<INSTALL> the module.
30
31=back
32
33Here's how to perform each step for each operating system. This is
34I<not> a substitute for reading the README and INSTALL files that
35might have come with your module!
36
37Also note that these instructions are tailored for installing the
38module into your system's repository of Perl modules. But you can
39install modules into any directory you wish. For instance, where I
40say C<perl Makefile.PL>, you can substitute C<perl
41Makefile.PL PREFIX=/my/perl_directory> to install the modules
42into C</my/perl_directory>. Then you can use the modules
43from your Perl programs with C<use lib
44"/my/perl_directory/lib/site_perl";> or sometimes just C<use
45"/my/perl_directory";>.
46
47=over 4
48
49=item *
50
51B<If you're on Unix,>
52
53You can use Andreas Koenig's CPAN module
54( http://www.perl.com/CPAN/modules/by-module/CPAN )
55to automate the following steps, from DECOMPRESS through INSTALL.
56
57A. DECOMPRESS
58
59Decompress the file with C<gzip -d yourmodule.tar.gz>
60
61You can get gzip from ftp://prep.ai.mit.edu/pub/gnu.
62
63Or, you can combine this step with the next to save disk space:
64
65 gzip -dc yourmodule.tar.gz | tar -xof -
66
67B. UNPACK
68
69Unpack the result with C<tar -xof yourmodule.tar>
70
71C. BUILD
72
73Go into the newly-created directory and type:
74
75 perl Makefile.PL
76 make
77 make test
78
79D. INSTALL
80
81While still in that directory, type:
82
83 make install
84
85Make sure you have the appropriate permissions to install the module
86in your Perl 5 library directory. Often, you'll need to be root.
87
88That's all you need to do on Unix systems with dynamic linking.
89Most Unix systems have dynamic linking -- if yours doesn't, or if for
90another reason you have a statically-linked perl, B<and> the
91module requires compilation, you'll need to build a new Perl binary
92that includes the module. Again, you'll probably need to be root.
93
94=item *
95
96B<If you're running Windows 95 or NT with the ActiveState port of Perl>
97
98 A. DECOMPRESS
99
100You can use the shareware Winzip ( http://www.winzip.com ) to
101decompress and unpack modules.
102
103 B. UNPACK
104
105If you used WinZip, this was already done for you.
106
107 C. BUILD
108
109Does the module require compilation (i.e. does it have files
110that end in .xs, .c, .h, .y, .cc, .cxx, or .C)? If it does, you're on
111your own. You can try compiling it yourself if you have a C compiler.
112If you're successful, consider uploading the resulting binary to the
113CPAN for others to use. If it doesn't, go to INSTALL.
114
115 D. INSTALL
116
117Copy the module into your Perl's I<lib> directory. That'll be one
118of the directories you see when you type
119
120 perl -e 'print "@INC"'
121
122=item *
123
124B<If you're running Windows 95 or NT with the core Windows distribution of Perl,>
125
126 A. DECOMPRESS
127
128When you download the module, make sure it ends in either
129C<.tar.gz> or C<.zip>. Windows browsers sometimes
130download C<.tar.gz> files as C<_tar.tar>, because
131early versions of Windows prohibited more than one dot in a filename.
132
133You can use the shareware WinZip ( http://www.winzip.com ) to
134decompress and unpack modules.
135
136Or, you can use InfoZip's C<unzip> utility (
137http://www.cdrom.com/pub/infozip/Info-Zip.html ) to uncompress
138C<.zip> files; type C<unzip yourmodule.zip> in
139your shell.
140
141Or, if you have a working C<tar> and C<gzip>, you can
142type
143
144 gzip -cd yourmodule.tar.gz | tar xvf -
145
146in the shell to decompress C<yourmodule.tar.gz>. This will
147UNPACK your module as well.
148
149 B. UNPACK
150
151All of the methods in DECOMPRESS will have done this for you.
152
153 C. BUILD
154
155Go into the newly-created directory and type:
156
157 perl Makefile.PL
158 dmake
159 dmake test
160
161Depending on your perl configuration, C<dmake> might not be
162available. You might have to substitute whatever C<perl
163-V:make> says. (Usually, that will be C<nmake> or
164C<make>.)
165
166 D. INSTALL
167
168While still in that directory, type:
169
170 dmake install
171
172=item *
173
174B<If you're using a Macintosh,>
175
176A. DECOMPRESS
177
178You can either use StuffIt Expander ( http://www.aladdinsys.com/ ) in
179combination with I<DropStuff with Expander Enhancer>
180(shareware), or the freeware MacGzip (
181http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html ).
182
183B. UNPACK
184
185If you're using DropStuff or Stuffit, you can just extract the tar
186archive. Otherwise, you can use the freeware I<suntar> (
187http://www.cirfid.unibo.it/~speranza ).
188
189C. BUILD
190
191Does the module require compilation?
192
1931. If it does,
194
195Overview: You need MPW and a combination of new and old CodeWarrior
196compilers for MPW and libraries. Makefiles created for building under
197MPW use the Metrowerks compilers. It's most likely possible to build
198without other compilers, but it has not been done successfully, to our
199knowledge. Read the documentation in MacPerl: Power and Ease (
200http://www.ptf.com/macperl/ ) on porting/building extensions, or find
201an existing precompiled binary, or hire someone to build it for you.
202
203Or, ask someone on the mac-perl mailing list (mac-perl@iis.ee.ethz.ch)
204to build it for you. To subscribe to the mac-perl mailing list, send
205mail to mac-perl-request@iis.ee.ethz.ch.
206
2072. If the module doesn't require compilation, go to INSTALL.
208
209D. INSTALL
210
211Make sure the newlines for the modules are in Mac format, not Unix format.
212Move the files manually into the correct folders.
213
214Move the files to their final destination: This will
215most likely be in C<$ENV{MACPERL}site_lib:> (i.e.,
216C<HD:MacPerl folder:site_lib:>). You can add new paths to
217the default C<@INC> in the Preferences menu item in the
218MacPerl application (C<$ENV{MACPERL}site_lib:> is added
219automagically). Create whatever directory structures are required
220(i.e., for C<Some::Module>, create
221C<$ENV{MACPERL}site_lib:Some:> and put
222C<Module.pm> in that directory).
223
224Run the following script (or something like it):
225
226 #!perl -w
227 use AutoSplit;
228 my $dir = "${MACPERL}site_perl";
229 autosplit("$dir:Some:Module.pm", "$dir:auto", 0, 1, 1);
230
231Eventually there should be a way to automate the installation process; some
232solutions exist, but none are ready for the general public yet.
233
234=item *
235
236B<If you're on the DJGPP port of DOS,>
237
238 A. DECOMPRESS
239
240djtarx ( ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/ )
241will both uncompress and unpack.
242
243 B. UNPACK
244
245See above.
246
247 C. BUILD
248
249Go into the newly-created directory and type:
250
251 perl Makefile.PL
252 make
253 make test
254
255You will need the packages mentioned in C<Readme.dos>
256in the Perl distribution.
257
258 D. INSTALL
259
260While still in that directory, type:
261
262 make install
263
264You will need the packages mentioned in Readme.dos in the Perl distribution.
265
266=item *
267
268B<If you're on OS/2,>
269
270Get the EMX development suite and gzip/tar, from either Hobbes (
271http://hobbes.nmsu.edu ) or Leo ( http://www.leo.org ), and then follow
272the instructions for Unix.
273
274=item *
275
276B<If you're on VMS,>
277
278When downloading from CPAN, save your file with a C<.tgz>
279extension instead of C<.tar.gz>. All other periods in the
280filename should be replaced with underscores. For example,
281C<Your-Module-1.33.tar.gz> should be downloaded as
282C<Your-Module-1_33.tgz>.
283
284A. DECOMPRESS
285
286Type
287
288 gzip -d Your-Module.tgz
289
290or, for zipped modules, type
291
292 unzip Your-Module.zip
293
294Executables for gzip, zip, and VMStar ( Alphas:
295http://www.openvms.digital.com/cd/000TOOLS/ALPHA/ and Vaxen:
296http://www.openvms.digital.com/cd/000TOOLS/VAX/ ).
297
298gzip and tar
299are also available at ftp://ftp.digital.com/pub/VMS.
300
301Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip
302package. The former is a simple compression tool; the latter permits
303creation of multi-file archives.
304
305B. UNPACK
306
307If you're using VMStar:
308
309 VMStar xf Your-Module.tar
310
311Or, if you're fond of VMS command syntax:
312
313 tar/extract/verbose Your_Module.tar
314
315C. BUILD
316
317Make sure you have MMS (from Digital) or the freeware MMK ( available from MadGoat at http://www.madgoat.com ). Then type this to create the
318DESCRIP.MMS for the module:
319
320 perl Makefile.PL
321
322Now you're ready to build:
323
324 mms
325 mms test
326
327Substitute C<mmk> for C<mms> above if you're using MMK.
328
329D. INSTALL
330
331Type
332
333 mms install
334
335Substitute C<mmk> for C<mms> above if you're using MMK.
336
337=item *
338
339B<If you're on MVS>,
340
341Introduce the .tar.gz file into an HFS as binary; don't translate from
342ASCII to EBCDIC.
343
344A. DECOMPRESS
345
346 Decompress the file with C<gzip -d yourmodule.tar.gz>
347
348 You can get gzip from
349 http://www.s390.ibm.com/products/oe/bpxqp1.html.
350
351B. UNPACK
352
353Unpack the result with
354
355 pax -o to=IBM-1047,from=ISO8859-1 -r < yourmodule.tar
356
357The BUILD and INSTALL steps are identical to those for Unix. Some
358modules generate Makefiles that work better with GNU make, which is
359available from http://www.mks.com/s390/gnu/index.htm.
360
361=back
362
363=head1 HEY
364
365If you have any suggested changes for this page, let me know. Please
366don't send me mail asking for help on how to install your modules.
367There are too many modules, and too few Orwants, for me to be able to
368answer or even acknowledge all your questions. Contact the module
369author instead, or post to comp.lang.perl.modules, or ask someone
370familiar with Perl on your operating system.
371
372=head1 AUTHOR
373
374Jon Orwant
375
376orwant@tpj.com
377
378The Perl Journal, http://tpj.com
379
380with invaluable help from Brandon Allbery, Charles Bailey, Graham
381Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley,
382Nick Ing-Simmons, Tuomas J. Lukka, Laszlo Molnar, Chris Nandor, Alan
383Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan
384Sugalski, Larry Virden, and Ilya Zakharevich.
385
386July 22, 1998
387
388=head1 COPYRIGHT
389
390Copyright (C) 1998 Jon Orwant. All Rights Reserved.
391
392Permission is granted to make and distribute verbatim copies of this
393documentation provided the copyright notice and this permission notice are
394preserved on all copies.
395
396Permission is granted to copy and distribute modified versions of this
397documentation under the conditions for verbatim copying, provided also
398that they are marked clearly as modified versions, that the authors'
399names and title are unchanged (though subtitles and additional
400authors' names may be added), and that the entire resulting derived
401work is distributed under the terms of a permission notice identical
402to this one.
403
404Permission is granted to copy and distribute translations of this
405documentation into another language, under the above conditions for
406modified versions.
407