installing lots of perl modules

Posted by Colin Pickard on Server Fault See other posts from Server Fault or by Colin Pickard
Published on 2011-02-22T16:19:46Z Indexed on 2011/02/26 23:27 UTC
Read the original article Hit count: 372

Filed under:

Hi,

I've been landed with the job of documenting how to install a very complicated application onto a clean server. Part of the application requires a lot of perl scripts, each of which seem to require lots of different perl modules.

I don't know much about perl, and I only know one way to install the required modules. This means my documentation now looks this:

Type each of these commands and accept all the defaults:

sudo perl -MCPAN -e 'install JSON'
sudo perl -MCPAN -e 'install Date::Simple'
sudo perl -MCPAN -e 'install Log::Log4perl'
sudo perl -MCPAN -e 'install Email::Simple'
(.... continues for 2 more pages... )

Is there any way I can do all this one line like I can with aptitude i.e.

Type the following command and go get a coffee:

sudo aptitude install openssh-server libapache2-mod-perl2 build-essential ...

Thank you (on behalf of the long suffering people who will be reading my document)


EDIT: The best way to do this is to use the packaged versions. For the modules which were not packaged for Ubuntu 10.10 I ended up with a little perl script which I found here )

#!/usr/bin/perl -w
    use CPANPLUS;
    use strict;
    CPANPLUS::Backend->new( conf => { prereqs => 1 } )->install(
        modules => [ qw(
            Date::Simple
            File::Slurp
            LWP::Simple
            MIME::Base64
            MIME::Parser
            MIME::QuotedPrint
        ) ]
    );

This means I can put a nice one liner in my document:

sudo perl installmodules.pl

© Server Fault or respective owner

Related posts about perl