A quickstart guide to installing CPAN modules on Linux.
WHAT IS CPAN
CPAN is the Comprehensive Perl Archive Network, a large collection of perl software and documentation. Perl experts use it to obtain the building blocks for their creations; I use it as a distribution-agnostic perl repository.
Many distributions carry common perl modules in their own package managers. So for example, on Mageia 2 I have my choice of the package perl-XML-Sablotron or the CPAN module XML::Sablotron. Which you prefer is a matter of personal preference.
You’ll need perl, which is installed by default on most Linux distros.
You’ll need make, which should be available in every distro’s repositories.
You’ll need either cpan or cpanm. Every perl installation I’ve used came out of the box with one or the other, and either is fine. The instructions below assume cpan; modify as needed for your case.
You really ought to have cpanminus, a script to get, unpack, build and install modules from CPAN. It is available in some distributions’ repositories, or you can make it the first CPAN module you fetch, with cpan App::cpanminus as root.
Install any module you can find with the command cpan Module::Name as root.
TIPS AND TRICKS
Most modules build themselves quickly, but some take a while. Be patient.
Modules should build themselves, but if an error occurs it often has an easy fix. Failed installs will end with a message similar to “Installing HTML::WebMake failed. See /root/.cpanm/build.log for details.” The log should provide clues. I start by installing any dependencies cited one at a time, then try installing the module again.
Each module should have documentation on the CPAN site, which you can find as described above.
TODO: Document how to uninstall modules.