I have recently been checking out various systems to find out what
versions of Perl
modules are installed on them, and this can get a little tedious if
you do this the
usual way, which for me at least is a command using perl -M ...

I found the following nice little program on perlmonks which really improves the
situation quite a bit. It not only shows you which version you have
installed, it shows
the most recent version available from CPAN.

http://www.perlmonks.org/?node_id=37237

#!/usr/bin/perl

use CPAN;

printf("%-20s %10s %10s\n", "Module", "Installed", "CPAN");

foreach $a (@ARGV) {
  foreach $mod (CPAN::Shell->expand("Module", $a)){
    printf("%-20s %10s %10s %s\n",
      $mod->id,
      $mod->inst_version eq "undef" || !defined($mod->inst_version)
        ? "-" : $mod->inst_version,
      $mod->cpan_version eq "undef" || !defined($mod->cpan_version)
        ? "-" : $mod->cpan_version,
      $mod->uptodate ? "" : "*"
    );
  }
}

And so when I run as follows...

[EMAIL PROTECTED] ted]# perl version.pl CGI WordNet::Similarity
WordNet::QueryData Text::Similarity WordNet::Tools

I get the following nice little report...

Module                Installed       CPAN
CGI                          3.10       3.37 *
WordNet::Similarity   2.04       2.04
WordNet::QueryData 1.47       1.47
Text::Similarity          0.02       0.06 *
WordNet::Tools         2.04       2.04

Very useful I think...

Enjoy,
Ted

-- 
Ted Pedersen
http://www.d.umn.edu/~tpederse

Reply via email to