Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials

installing cpan modules

( categories: )

There are basically 2 methods to install a module from CPAN: manual and automatic (using the CPAN module).

Which method to use depend of the situation; using the automatic method is easier but assumes you are connected to the Internet; another advantage of using the CPAN shell is that it tries to resolve potential module dependency problems automatically (if you use the manual method, you have to manually resolve this issues). On the other hand, if you already have downloaded the perl module and/or you don't have Internet access, then the manual method could be the way to go.

-- Manual installation

1. Download the tarball file from www.cpan.org to your computer

2. Decompress and unpack the tarball file:

gzip -dc file.tar.gz | tar xvf -

3. Go into the folder that was created by the previous command

4. Build the module executing the following commands:

perl Makefile.PL
make
make test

5. If everything went well so far, install the module:

make install


list the installed modules

( categories: | )

There are several ways to obtain the list of perl modules installed in a system:

-- Using perldoc

There are 2 commands, depending of the kind of perl module:

perldoc perlmodlib

'perldoc perlmodlib' list the modules that come preinstalled with the standard perl package.

perldoc perllocal

'perldoc perllocal' lists the optional modules that are installed in your system that don't come with perl by default.

This command returns lots of useful information for every optional module installed, like the installation date, the directory where the module was installed, the module version number, etc.


check if a module is installed

( categories: | )

Let's say that you want to know whether module Tie::Hash is installed. To find out, execute the following from the command line:

perl -MTie::Hash -e 1

If you don't get any output from the above command then the module is installed; if you get an error, it's not installed


Syndicate content