Saturday, May 26, 2007

Check whether a Perl module is installed

The Perl code print all installed modules.
#!/usr/bin/perl 
# check_modules.pl

use strict; 
use ExtUtils::Installed; 

my $inst= ExtUtils::Installed->new(); 
my @modules = $inst->modules(); 

foreach(@modules) 
{ 
   my $ver = $inst->version($_) || "???"; 
   printf("%-14s -v %s\n", $_, $ver);
} 
exit 0;
 
Blogger Template Layout Design by [ METAMUSE ] : Code Name Gadget 1.1 Power By freecode-frecode.blogger.com & blogger.com Programming Blogs - BlogCatalog Blog Directory