Installing Perl Modules

Grepmail is a utility written in Perl that extracts individual messages from a mail file. Installation can be tricky because it requires other perl modules. This article describes how to install perl modules using grepmail as an example. Step 1: unpack grepmail
   tar -xzvf grepmail-5.23.tar.gz
   cd grep*
   perl Makefile.PL
If it says something like
Warning: prerequisite Mail::Mbox::MessageParser 1.1 not found.
Writing Makefile for grepmail
this means you must install MessageParser before grepmail can be installed.

You could Download MessageParser.pm from http://www.cpan.org and install it manually. Since MessageParser.pm doesn't come with a Makefile.PL, the file is simply copied to the appropriate location. Unfortunately, figuring out the appropriate location is not always easy. You could edit your perl script to force it to look in a specific location, but this will cause problems later when you forget what you did.

Alternatively, Perl modules can be installed interactively using the following procedure. As root, type:
   perl -MCPAN -e shell
   install MessageParser
It will say
   Warning: Cannot install MessageParser, don't know what it is.
   Try the command
       i /MessageParser/
Type
   cpan> i /MessageParser/
If it finds the module, it will say
Distribution    D/DC/DCOPPIT/Mail-Mbox-MessageParser-1.14.tar.gz
Module  Mail::Mbox::MessageParser \
(D/DC/DCOPPIT/Mail-Mbox-MessageParser-1.14.tar.gz)
Install the module
   install Mail::Mbox::MessageParser
Continue installing other modules until grepmail compiles with no warnings; then stop.

Now the grepmail should install.
   perl Makefile.PL
   make
   make install

To reinstall everything, type
 cpan> install Bundle::CPAN

If an installation bombs out for some reason, you have to quit and re-start. Otherwise, it will simply repeat the message, "Won't test, Won't install."


Back