Skip to content

install perl modules

Byrne Reese edited this page May 12, 2011 · 1 revision

Installing Perl Modules

Normally the process of installing Perl modules is very, very straightforward. Most systems come standard these days with a Perl package manager, not dissimilar to yum or apt, called "cpan." In almost all circumstances the process of installing a Perl module is as simple as running the following command as root:

 prompt> cpan Perl::Module

What do to when things fail

Sometimes a Perl module will have tons of prerequisites, and for whatever reason, one of those prerequisites will stubbornly not install. The first thing to try is identify the perl module having difficulty, and try to install that module separately. Let's take a look at an example:

prompt> cpan Perl::Module
***** snip *****
---- Unsatisfied dependencies detected during [B/BY/BYRNE/Perl-Module-0.01.tar.gz] -----
XML::Simple
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]
***** snip *****
Running make for G/GR/GRANTM/XML-Simple-2.16.tar.gz
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install

Depending upon how many prerequisites are queued up for installation the key phrase "Make has some problems, won't install" may scroll by on your console too quickly for you to see. If you see a bad exit status when your prompt returns, however, scroll back up and identify which module had difficulty. In this case, it is XML::Simple. So now, try to install that module separately like so:

prompt> cpan XML::Simple

Doing this has two advantages:

  1. It will help you to isolate the build error that occurred.
  2. It may actually work. Why? I don't know, but sometimes CPAN has difficulty installing lots of Perl modules at once.

If this works and the module is installed properly, then try re-installing the Perl module you were trying to install initially.

If it does not work, then there is most likely a missing dependency or pre-requisite. Consult the documentation for the perl module that is failing and see if anything can be learned.

Under virtually no circumstances should you "force" the installation of a Perl module. If a unit test fails, then that is an indication that something is wrong. And if something is "wrong" it is best to determine what it is, resolve it, and then continue. This is a production system after all, don't you want everything to be perfect?

Clone this wiki locally