Programmer's Cookbook

Recipes for the practical programmer

Thursday, February 09, 2006

 

Automate Perl Module Installation

This utility allows you to automate the installation of a set of Perl modules. List the modules in the @modules array and run the script. It uses the CPAN module to download and install the modules, as well as requisite modules.

#!/usr/bin/perl

use CPAN;

my @modules = qw(
HTML::Template
XML::EasyObj
);

# install needed modules
for my $mod (@modules) {
print "Checking module '$mod' ...\n";
my $obj = CPAN::Shell->expand('Module',$mod);
$obj->install;
}

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?