in reply to Retrieve list of used modules and their version numbers
Here is a similar one that runs from the command line.
#!/usr/bin/perl -w use strict; for my $module (@ARGV) { my $version; eval "require $module"; if (not $@) { $version = $module->VERSION; $version = '(unknown)' if not defined $version; } else { $version = '(not installed)'; } printf " %-24s\t%s\n", $module, $version; } __END__ # Sample output. $ perl modver.pl Encode Foo strict Error::Simple Encode 2.10 Foo (not installed) strict 1.03 Error::Simple (unknown)
--
John.
|
---|
In Section
Cool Uses for Perl