Cpan

From Linuxintro
Revision as of 17:41, 29 March 2010 by imported>ThorstenStaerk (→‎See also)

CPAN is an acronym for Comprehensive Perl Archive Network. It allows for downloading perl modules from the web.

Run CPAN like this:

# perl -mCPAN -e CPAN::shell
cpan> install Foo::Bar

e.g.

cpan> install Math::XOR

You'll run that as root if your Perl is installed in a system-wide location. The first time you run that first command, you'll be prompted a number of questions to initially configure the module. For most of them, you just hit ENTER to accept the default.

Usecase

If you run a perl program and get the error message

Can't locate Net/DAV/Server.pm in @INC (@INC contains: /usr/lib/perl5/5.8.8/x86_
64-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/x86_64
-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr
/lib/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_per
l/5.8.8 /usr/lib/perl5/vendor_perl .) at ./__webdav.pl line 14.
BEGIN failed--compilation aborted at ./__webdav.pl line 14.

You see it's time to install Net::Dav::Server.

# perl -mCPAN -e CPAN::shell
cpan> install Net::Dav::Server

See also