Archive for the tag 'Cpan'

CPAN - query, download and build perl modules from CPAN sites

Interactive mode:

perl -MCPAN -e shell;

Batch mode:

use CPAN;
autobundle, clean, install, make, recompile, test

Example:


root@laptop:~# perl -MCPAN -e shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]> test
CPAN: Storable loaded ok (v2.18)
CPAN: LWP::UserAgent loaded ok (v5.819)
CPAN: Time::HiRes loaded ok (v1.9711)

I would like to connect to one of the following sites to get ‘authors/01mailrc.txt.gz’:

http://www.perl.org/CPAN/
ftp://ftp.perl.org/pub/CPAN/

Is it OK to try to connect to the Internet? [yes]

Source: Man Page - http://theoryx5.uwinnipeg.ca/CPAN/perl/lib/CPAN.html

SBDavid

Installing Perl Modules

Installing Perl Modules.

Perl Modules can be obtained from the CPAN (Comprehensive Perl Archive Network) at http://search.cpan.org.

The easiest way to install Perl modules on Unix is to use the CPAN module. For example:

shell> perl -MCPAN -e shell
cpan> install DBI
cpan> install DBD::mysql

DBD::mysql is the Perl5 Database Interface driver for the MySQL database.

To find a particular module, use the i command, followed by an expression that you want to search for:

cpan> i /Time/

CPAN.pm will go out to the CPAN mirrror that you selected, download the list of modules, and tell you which ones match the search word.

To install a module, just type:

cpan> install Time::CTime

CPAN.pm takes care of the whole process. It downloads the compressed file, unpacks it, builds it, and installs it all for you, unless there is a problem with the installation process. If there are other modules on which this module relies, it will also download and install those.