This articles assumes you are compiling the modules and installing them yourself. If possible, it is often easier to use a package manager such as rpm on linux, or ppm for ActivePerl. After determining which modules you need, you’ll have to download and install them. They can be found from CPAN.
Look at the documentation that comes with module you downloaded. You may find special installation instructions, and readme files.
Typically there are 4 steps:
Create the Makefile. Usually this is accomplished by
perl Makefile.PL. Note that there are other options available here such as
PREFIXthat will allow you to specify where the module should be installed. I use this to test modules in my own private directory. e.g. the full command line may be:
perl Makefile.PL PREFIX=/home/jurn/perl
Compile. This is done using the standard
Test. This is usually done using
Installation. This is done by issuing a
make install. You will need to be root for this, unless you specified a non-standard installation directory when creating the Makefile. If you forgot, you can also modify the Makefile at this stage before issuing the
If you installed the modules to a non-standard directory you can use the environment variable
PERL5LIB when running
PERL5LIB depends on the
PREFIX directory you specified when creating the Makefile.
In the example above, the module ended up in the following directory
so that is what
PERL5LIB should be set to.
At the prompt,
$ perl -MCPAN -eshell
perl will ask you for some configuration, such as where the closest CPAN repository is, and how to access it. If you’ve configured it properly, you will get to the cpan prompt. From here you can enter the install command and perl will download, compile and install the modules into your local system.
e.g. To install the 3 modules (and all required dependencies)
Net::IP type in the following.
cpan> install HTML::Parser LWP::UserAgent Net::IP