Installing CPAN modules

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.

PREPARATION
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.

INSTALLING MODULES
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.

REFERENCES
The document I referred to when creating this quickstart guide is How to install CPAN modules
CPAN module search
The CPAN FAQ

Advertisements

About Warren Post

So far: Customer support guy, jungle guide, IT consultant, beach bum, entrepreneur, teacher, diplomat, over-enthusiastic cyclist. Tomorrow: who knows?
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

One Response to Installing CPAN modules

  1. Pingback: Webmake | A maze of twisty little passages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s