perlman
gods
<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
perlmodinstall - Installing
<FONT SIZE=-1>CPAN</FONT> Modules
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
You can think of a module as the fundamental unit of reusable Perl code;
see [perlman:perlmod|the perlmod manpage] for details. Whenever anyone creates a chunk of Perl code that they think will be useful to the world, they register as a Perl developer at <A HREF="http://www.perl.com/CPAN/modules/04pause.html">http://www.perl.com/CPAN/modules/04pause.html</A> so that they can then upload their code to the
<FONT SIZE=-1>CPAN.</FONT> The
<FONT SIZE=-1>CPAN</FONT> is the Comprehensive Perl Archive Network and can be accessed at <A HREF="http://www.perl.com/CPAN/.">http://www.perl.com/CPAN/.</A>
<P>
This documentation is for people who want to download
<FONT SIZE=-1>CPAN</FONT> modules and install them on their own computer.
<P>
<HR>
<H2><A NAME="PREAMBLE">PREAMBLE</A></H2>
<P>
You have a file ending in .tar.gz (or, less often, .zip). You know there's
a tasty module inside. There are four steps you must now take:
<DL>
<DT><STRONG><A NAME="item_DECOMPRESS">DECOMPRESS the file</A></STRONG><DD>
<DT><STRONG><A NAME="item_UNPACK">UNPACK the file into a directory</A></STRONG><DD>
<DT><STRONG><A NAME="item_BUILD">BUILD the module (sometimes unnecessary)</A></STRONG><DD>
<DT><STRONG><A NAME="item_INSTALL">INSTALL the module.</A></STRONG><DD>
</DL>
<P>
Here's how to perform each step for each operating system. This is
<EM>not</EM> a substitute for reading the
<FONT SIZE=-1>README</FONT> and
<FONT SIZE=-1>INSTALL</FONT> files that might have come with your module!
<P>
Also note that these instructions are tailored for installing the module into your system's repository of Perl modules. But you can install modules into any directory you wish. For instance, where
<FONT SIZE=-1>I</FONT> say
<CODE>perl Makefile.PL</CODE>, you can substitute <CODE>perl
Makefile.PL PREFIX=/my/perl_directory</CODE> to install the modules into <CODE>/my/perl_directory</CODE>. Then you can use the modules from your Perl programs with <CODE>use lib
"/my/perl_directory/lib/site_perl";</CODE> or sometimes just <CODE>use
"/my/perl_directory";</CODE>.
<UL>
<LI>
<P>
<STRONG>If you're on Unix,</STRONG>
<P>
You can use Andreas Koenig's
<FONT SIZE=-1>CPAN</FONT> module ( <A HREF="http://www.perl.com/CPAN/modules/by-module/CPAN">http://www.perl.com/CPAN/modules/by-module/CPAN</A> ) to automate the following steps, from
<FONT SIZE=-1>DECOMPRESS</FONT> through
<FONT SIZE=-1>INSTALL.</FONT>
<P>
<FONT SIZE=-1>A.</FONT>
<FONT SIZE=-1>DECOMPRESS</FONT>
<P>
Decompress the file with <CODE>gzip -d yourmodule.tar.gz</CODE>
<P>
You can get gzip from <A
HREF="ftp://prep.ai.mit.edu/pub/gnu.">ftp://prep.ai.mit.edu/pub/gnu.</A>
<P>
Or, you can combine this step with the next to save disk space:
<P>
<PRE> gzip -dc yourmodule.tar.gz | tar -xof -
</PRE>
<P>
<FONT SIZE=-1>B.</FONT>
<FONT SIZE=-1>UNPACK</FONT>
<P>
Unpack the result with <CODE>tar -xof yourmodule.tar</CODE>
<P>
<FONT SIZE=-1>C.</FONT>
<FONT SIZE=-1>BUILD</FONT>
<P>
Go into the newly-created directory and type:
<P>
<PRE> perl Makefile.PL
make
make test
</PRE>
<P>
<FONT SIZE=-1>D.</FONT>
<FONT SIZE=-1>INSTALL</FONT>
<P>
While still in that directory, type:
<P>
<PRE> make install
</PRE>
<P>
Make sure you have the appropriate permissions to install the module in
your Perl 5 library directory. Often, you'll need to be root.
<P>
That's all you need to do on Unix systems with dynamic linking. Most Unix
systems have dynamic linking -- if yours doesn't, or if for another reason
you have a statically-linked perl, <STRONG>and</STRONG> the module requires compilation, you'll need to build a new Perl binary
that includes the module. Again, you'll probably need to be root.
<P><LI>
<STRONG>If you're running Windows 95 or NT with the ActiveState port of Perl</STRONG>
<P>
<PRE> A. DECOMPRESS
</PRE>
<P>
You can use the shareware Winzip ( <A
HREF="http://www.winzip.com">http://www.winzip.com</A> ) to decompress and
unpack modules.
<P>
<PRE> B. UNPACK
</PRE>
<P>
If you used WinZip, this was already done for you.
<P>
<PRE> C. BUILD
</PRE>
<P>
Does the module require compilation (i.e. does it have files that end in .xs, .c, .h, .y, .cc, .cxx, or
<FONT SIZE=-1>.C)?</FONT> If it does, you're on your own. You can try compiling it yourself if you have a
<FONT SIZE=-1>C</FONT> compiler. If you're successful, consider uploading the resulting binary to the
<FONT SIZE=-1>CPAN</FONT> for others to use. If it doesn't, go to
<FONT SIZE=-1>INSTALL.</FONT>
<P>
<PRE> D. INSTALL
</PRE>
<P>
Copy the module into your Perl's <EM>lib</EM> directory. That'll be one of the directories you see when you type
<P>
<PRE> perl -e 'print "@INC"'
</PRE>
<LI>
<P>
<STRONG>If you're running Windows 95 or NT with the core Windows distribution of Perl,</STRONG>
<P>
<PRE> A. DECOMPRESS
</PRE>
<P>
When you download the module, make sure it ends in either
<CODE>.tar.gz</CODE> or <CODE>.zip</CODE>. Windows browsers sometimes download <CODE>.tar.gz</CODE> files as <CODE>_tar.tar</CODE>, because early versions of Windows prohibited more than one dot in a
filename.
<P>
You can use the shareware WinZip ( <A
HREF="http://www.winzip.com">http://www.winzip.com</A> ) to decompress and
unpack modules.
<P>
Or, you can use InfoZip's <CODE>unzip</CODE> utility ( <A
HREF="http://www.cdrom.com/pub/infozip/Info-Zip.html">http://www.cdrom.com/pub/infozip/Info-Zip.html</A>
) to uncompress
<CODE>.zip</CODE> files; type <CODE>unzip yourmodule.zip</CODE> in your shell.
<P>
Or, if you have a working <CODE>tar</CODE> and <CODE>gzip</CODE>, you can type
<P>
<PRE> gzip -cd yourmodule.tar.gz | tar xvf -
</PRE>
<P>
in the shell to decompress <CODE>yourmodule.tar.gz</CODE>. This will
<FONT SIZE=-1>UNPACK</FONT> your module as well.
<P>
<PRE> B. UNPACK
</PRE>
<P>
All of the methods in
<FONT SIZE=-1>DECOMPRESS</FONT> will have done this for you.
<P>
<PRE> C. BUILD
</PRE>
<P>
Go into the newly-created directory and type:
<P>
<PRE> perl Makefile.PL
dmake
dmake test
</PRE>
<P>
Depending on your perl configuration, <CODE>dmake</CODE> might not be available. You might have to substitute whatever <CODE>perl
-V:make</CODE> says. (Usually, that will be <CODE>nmake</CODE> or
<CODE>make</CODE>.)
<P>
<PRE> D. INSTALL
</PRE>
<P>
While still in that directory, type:
<P>
<PRE> dmake install
</PRE>
<LI>
<P>
<STRONG>If you're using a Macintosh,</STRONG>
<P>
<FONT SIZE=-1>A.</FONT>
<FONT SIZE=-1>DECOMPRESS</FONT>
<P>
You can either use StuffIt Expander ( <A
HREF="http://www.aladdinsys.com/">http://www.aladdinsys.com/</A> ) in
combination with <EM>DropStuff with Expander Enhancer</EM>
(shareware), or the freeware MacGzip ( <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>
<FONT SIZE=-1>B.</FONT>
<FONT SIZE=-1>UNPACK</FONT>
<P>
If you're using DropStuff or Stuffit, you can just extract the tar archive.
Otherwise, you can use the freeware <EM>suntar</EM> ( <A
HREF="http://www.cirfid.unibo.it/~speranza">http://www.cirfid.unibo.it/~speranza</A>
).
<P>
<FONT SIZE=-1>C.</FONT>
<FONT SIZE=-1>BUILD</FONT>
<P>
Does the module require compilation?
<P>
1. If it does,
<P>
Overview: You need
<FONT SIZE=-1>MPW</FONT> and a combination of new and old CodeWarrior compilers for
<FONT SIZE=-1>MPW</FONT> and libraries. Makefiles created for building under
<FONT SIZE=-1>MPW</FONT> use the Metrowerks compilers. It's most likely possible to build without other compilers, but it has not been done successfully, to our knowledge. Read the documentation in MacPerl: Power and Ease ( <A HREF="http://www.ptf.com/macperl/">http://www.ptf.com/macperl/</A> ) on porting/building extensions, or find an existing precompiled binary, or hire someone to build it for you.
<P>
Or, ask someone on the mac-perl mailing list (<A
HREF="mailto:mac-perl@iis.ee.ethz.ch">mac-perl@iis.ee.ethz.ch</A>) to build
it for you. To subscribe to the mac-perl mailing list, send mail to <A
HREF="mailto:mac-perl-request@iis.ee.ethz.ch.">mac-perl-request@iis.ee.ethz.ch.</A>
<P>
2. If the module doesn't require compilation, go to
<FONT SIZE=-1>INSTALL.</FONT>
<P>
<FONT SIZE=-1>D.</FONT>
<FONT SIZE=-1>INSTALL</FONT>
<P>
Make sure the newlines for the modules are in Mac format, not Unix format.
Move the files manually into the correct folders.
<P>
Move the files to their final destination: This will most likely be in <CODE>$ENV{MACPERL}site_lib:</CODE> (i.e.,
<CODE>HD:MacPerl folder:site_lib:</CODE>). You can add new paths to the default <CODE>@INC</CODE> in the Preferences menu item in the MacPerl application (<CODE>$ENV{MACPERL}site_lib:</CODE> is added automagically). Create whatever directory structures are required
(i.e., for <CODE>Some::Module</CODE>, create
<CODE>$ENV{MACPERL}site_lib:Some:</CODE> and put
<CODE>Module.pm</CODE> in that directory).
<P>
Run the following script (or something like it):
<P>
<PRE> #!perl -w
use AutoSplit;
my $dir = "${MACPERL}site_perl";
autosplit("$dir:Some:Module.pm", "$dir:auto", 0, 1, 1);
</PRE>
<P>
Eventually there should be a way to automate the installation process; some
solutions exist, but none are ready for the general public yet.
<P><LI>
<STRONG>If you're on the DJGPP port of DOS,</STRONG>
<P>
<PRE> A. DECOMPRESS
</PRE>
<P>
djtarx ( <A
HREF="ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/">ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/</A>
) will both uncompress and unpack.
<P>
<PRE> B. UNPACK
</PRE>
<P>
See above.
<P>
<PRE> C. BUILD
</PRE>
<P>
Go into the newly-created directory and type:
<P>
<PRE> perl Makefile.PL
make
make test
</PRE>
<P>
You will need the packages mentioned in <CODE>Readme.dos</CODE>
in the Perl distribution.
<P>
<PRE> D. INSTALL
</PRE>
<P>
While still in that directory, type:
<P>
<PRE> make install
You will need the packages mentioned in Readme.dos in the Perl distribution.
</PRE>
<LI>
<P>
<STRONG>If you're on OS/2,</STRONG>
<P>
Get the
<FONT SIZE=-1>EMX</FONT> development suite and gzip/tar, from either Hobbes
( <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 the
instructions for Unix.
<P><LI>
<STRONG>If you're on VMS,</STRONG>
<P>
When downloading from
<FONT SIZE=-1>CPAN,</FONT> save your file with a <CODE>.tgz</CODE>
extension instead of <CODE>.tar.gz</CODE>. All other periods in the filename should be replaced with underscores.
For example,
<CODE>Your-Module-1.33.tar.gz</CODE> should be downloaded as
<CODE>Your-Module-1_33.tgz</CODE>.
<P>
<FONT SIZE=-1>A.</FONT>
<FONT SIZE=-1>DECOMPRESS</FONT>
<P>
Type
<P>
<PRE> gzip -d Your-Module.tgz
</PRE>
<P>
or, for zipped modules, type
<P>
<PRE> unzip Your-Module.zip
</PRE>
<P>
Executables for gzip, zip, and VMStar ( Alphas: <A
HREF="http://www.openvms.digital.com/cd/000TOOLS/ALPHA/">http://www.openvms.digital.com/cd/000TOOLS/ALPHA/</A>
and Vaxen: <A
HREF="http://www.openvms.digital.com/cd/000TOOLS/VAX/">http://www.openvms.digital.com/cd/000TOOLS/VAX/</A>
).
<P>
gzip and tar are also available at <A
HREF="ftp://ftp.digital.com/pub/VMS.">ftp://ftp.digital.com/pub/VMS.</A>
<P>
Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip
package. The former is a simple compression tool; the latter permits
creation of multi-file archives.
<P>
<FONT SIZE=-1>B.</FONT>
<FONT SIZE=-1>UNPACK</FONT>
<P>
If you're using VMStar:
<P>
<PRE> VMStar xf Your-Module.tar
</PRE>
<P>
Or, if you're fond of
<FONT SIZE=-1>VMS</FONT> command syntax:
<P>
<PRE> tar/extract/verbose Your_Module.tar
</PRE>
<P>
<FONT SIZE=-1>C.</FONT>
<FONT SIZE=-1>BUILD</FONT>
<P>
Make sure you have
<FONT SIZE=-1>MMS</FONT> (from Digital) or the freeware
<FONT SIZE=-1>MMK</FONT> ( available from MadGoat at <A HREF="http://www.madgoat.com">http://www.madgoat.com</A> ). Then type this to create the
<FONT SIZE=-1>DESCRIP.MMS</FONT> for the module:
<P>
<PRE> perl Makefile.PL
</PRE>
<P>
Now you're ready to build:
<P>
<PRE> mms
mms test
</PRE>
<P>
Substitute <CODE>mmk</CODE> for <CODE>mms</CODE> above if you're using
<FONT SIZE=-1>MMK.</FONT>
<P>
<FONT SIZE=-1>D.</FONT>
<FONT SIZE=-1>INSTALL</FONT>
<P>
Type
<P>
<PRE> mms install
</PRE>
<P>
Substitute <CODE>mmk</CODE> for <CODE>mms</CODE> above if you're using
<FONT SIZE=-1>MMK.</FONT>
<P><LI>
<STRONG>If you're on MVS</STRONG>,
<P>
Introduce the .tar.gz file into an
<FONT SIZE=-1>HFS</FONT> as binary; don't translate from
<FONT SIZE=-1>ASCII</FONT> to
<FONT SIZE=-1>EBCDIC.</FONT>
<P>
<FONT SIZE=-1>A.</FONT>
<FONT SIZE=-1>DECOMPRESS</FONT>
<P>
<PRE> Decompress the file with C<gzip -d yourmodule.tar.gz>
</PRE>
<P>
<PRE> You can get gzip from
<A HREF="http://www.s390.ibm.com/products/oe/bpxqp1.html.">http://www.s390.ibm.com/products/oe/bpxqp1.html.</A>
</PRE>
<P>
<FONT SIZE=-1>B.</FONT>
<FONT SIZE=-1>UNPACK</FONT>
<P>
Unpack the result with
<P>
<PRE> pax -o to=IBM-1047,from=ISO8859-1 -r < yourmodule.tar
</PRE>
<P>
The
<FONT SIZE=-1>BUILD</FONT> and
<FONT SIZE=-1>INSTALL</FONT> steps are identical to those for Unix. Some modules generate Makefiles that work better with
<FONT SIZE=-1>GNU</FONT> make, which is available from <A HREF="http://www.mks.com/s390/gnu/index.htm.">http://www.mks.com/s390/gnu/index.htm.</A>
</UL>
<P>
<HR>
<H1><A NAME="HEY">HEY</A></H1>
<P>
If you have any suggested changes for this page, let me know. Please don't
send me mail asking for help on how to install your modules. There are too
many modules, and too few Orwants, for me to be able to answer or even
acknowledge all your questions. Contact the module author instead, or post
to comp.lang.perl.modules, or ask someone familiar with Perl on your
operating system.
<P>
<HR>
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
<P>
Jon Orwant
<P>
<A HREF="mailto:orwant@tpj.com">orwant@tpj.com</A>
<P>
The Perl Journal, <A HREF="http://tpj.com">http://tpj.com</A>
<P>
with invaluable help from Brandon Allbery, Charles Bailey, Graham Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley, Nick Ing-Simmons, Tuomas
<FONT SIZE=-1>J.</FONT> Lukka, Laszlo Molnar, Chris Nandor, Alan Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan Sugalski, Larry Virden, and Ilya Zakharevich.
<P>
July 22, 1998
<P>
<HR>
<H1><A NAME="COPYRIGHT">COPYRIGHT</A></H1>
<P>
Copyright
<FONT SIZE=-1>(C)</FONT> 1998 Jon Orwant. All Rights Reserved.
<P>
Permission is granted to make and distribute verbatim copies of this
documentation provided the copyright notice and this permission notice are
preserved on all copies.
<P>
Permission is granted to copy and distribute modified versions of this
documentation under the conditions for verbatim copying, provided also that
they are marked clearly as modified versions, that the authors' names and
title are unchanged (though subtitles and additional authors' names may be
added), and that the entire resulting derived work is distributed under the
terms of a permission notice identical to this one.
<P>
Permission is granted to copy and distribute translations of this
documentation into another language, under the above conditions for
modified versions.
<HR>
<BR>Return to the [Library]<BR>