Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

RE: Find perl module version from command-line

by Fastolfe (Vicar)
on Oct 18, 2000 at 02:27 UTC ( #37242=note: print w/replies, xml ) Need Help??

in reply to Find perl module version from command-line

Things like this are frequently done in conjunction with CPAN lookups. Many people don't realize that the CPAN module itself can be used in your own scripts. You can extend lachoy's example a lot further by using CPAN, at the expense of a lot of time:
#!/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 ? "" : "*" ); } }
Running with arguments: DBI /DBD::/
Module Installed CPAN DBI 1.13 1.14 * DBD::ADO 0.14 1.17 * DBD::ASAny - 1.09 * DBD::Adabas - 0.2003 * DBD::Altera - - * DBD::CSV - 0.1024 *
...etc. Though if all you're interested in is the installed version of modules, you're FAR better off going with lachoy's script, since the code above will rely upon CPAN data, which will require time to fetch, extract and browse.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://37242]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2017-04-25 22:23 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (466 votes). Check out past polls.