Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Finding Module Versions - How Would You Do It?

by kcott (Abbot)
on Feb 13, 2013 at 07:38 UTC ( #1018489=note: print w/ replies, xml ) Need Help??


in reply to Finding Module Versions - How Would You Do It?

G'day Tommy,

With older versions of Perl, I used to do:

$ perl -e 'use Test::More; print $Test::More::VERSION, "\n"' 0.98

With newer versions of Perl, I now use the slightly shorter:

$ perl -E 'use Test::More; say $Test::More::VERSION' 0.98

And to automate, using a selection of modules from your list, you could do something like:

$ module_list='Test::More English File::Find Test::Perl::Critic' $ for i in $module_list; do > echo $i > eval "echo \`perl -E 'use $i; say \$$i::VERSION'\`" > done Test::More 0.98 English 1.04 File::Find 1.19 Test::Perl::Critic 1.02

-- Ken


Comment on Re: Finding Module Versions - How Would You Do It?
Select or Download Code
Re^2: Finding Module Versions - How Would You Do It?
by hippo (Curate) on Feb 13, 2013 at 14:37 UTC

    I have this bash function in my .bashrc:

    pmv () { perl -M$1 -e "print \$$1::VERSION . qq/\n/;"; }

    which is based along similar lines and works for me. It is invoked like this:

    pmv Test::More

    Simple, but effective.

      Have you two even read the post at all? This is exactly what Tommy doesn’t want to do for reasons explained there.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018489]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-08-22 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (156 votes), past polls