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