From Linuxintro

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


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.


If you run a perl program and get the error message

Can't locate Net/DAV/ 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 ./ line 14.
BEGIN failed--compilation aborted at ./ line 14.

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

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

Delete a module

There are various reasons why you would want to delete a module, e.g. because you have called

install X11::Protocol

from a wrong place and you did not get the window shown, so it is mis-configured. If this happens to you, delete the module manually, e.g.

rm -rf /usr/lib/perl5/site_perl/5.10.0/X11

See also