"Perl for Perl Newbies" - Part 4CPAN ModulesThe -MCPAN Interface

1.2. The -MCPAN Interface

Perl has a module called CPAN with which one can install CPAN modules along with all of the modules they depend on. To invoke it type perl -MCPAN -e shell at the command line while being a super-user, and follow the instructions it gives you. The install command can be used to automatically install modules. For example: to install the XML::XSLT module, the following can be done from the CPAN prompt:

cpan> install XML::XSLT

This will in turn install "XML::Parser" and other modules it needs.


CPANPLUS.pm is a more modern, modular, and enhanced alternative to CPAN.pm. It is part of perl-5.10.x and above, but can be installed separately. As such, its use is more recommended.

Operating System/Distribution - Specific Ways

Normally, you should look for a suitable native package of the CPAN module for your operating system or distribution. If that fails, you should consider building your own package. Consult your distribution's help channels for more information.

Written by Shlomi Fish