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