Monday, April 14, 2014

How can you install a list of modules if already not there?

my @module = ('Text::CSV::Separator 0.20',
                       'Getopt::Lucid',
                          'Apache::Htpasswd',
                          'IO::CaptureOutput',
 );
for(@module) {
  eval;
if($@) {
$_=~/\w+\W(\S+)/;
print "Module $1 does not exist! Trying to install it.\n";
system("ppm", "install", "$_");
}
else {
print "Module $_ exists!\n";
}
}

No comments :