I'm with hippo; not sure why you are doing this but here are some ideas.
First, MetaCPAN has its own module. Borrowed directly from MetaCPAN::Client's own Pod:
#Or, to get either the given version of a release, or the latest:
my $releases = $mcpan->release( {
all => [
{ distribution => 'GraphViz2' },
($version ? { version => $version } : { status => 'latest' }),
],
} );
My guess is that you are trying to find out what is latest and greatest with a module. If you are not doing that perhaps you should be trying to ensure that you have the correct version installed. There are modules specifically designed for this but, to me, unless a script has no dependencies I simply do not see why people do not write up some actual tests.
#!/bin/bash
perl -MTest::More=no_plan -e 'my $prio = shift; if (use_ok(qq~$prio~))
+ { no strict q~refs~; print ${$prio . qq~::VERSION~} . qq~\n~} else {
+print qq~WTF!!!!!!\n\n~};' Exporter
Prints...
ok 1 - use Exporter;
5.78
1..1
Whereas...
perl ... BLAHMODULE
Prints...
not ok 1 - use BLAHMODULE;
...
WTF!!!!!!
The above is actualy bad usage but I wanted to demonstrate that you can check for versions on the command line via passing in the module name. The use_ok() method in Test::More takes a version:
use_ok(qq~CGI~,9.999);
Which fails, of course, because that is not the installed version.
Celebrate Intellectual Diversity
|