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