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

Re [1]: Which version is this module?

by Intrepid (Deacon)
on Feb 13, 2004 at 10:43 UTC ( [id://328764]=note: print w/replies, xml ) Need Help??


in reply to Re: Which version is this module?
in thread Which version is this module?

robobunny wrote:
And with minor modifications, this is also a valid shell script, for those on UNIX:

Weeellllll ... {G} ... with MAJOR modifications and wrapping it in a shell function wrapper, so it is available at every login w/o regard to PATH location, this idea becomes:

# (ba)sh function wrapper for Perl code. "perltest" is admittedly NOT + a good name ;-) perltest () { perl -e' my$modn = my$mod = "'$1'"; $mod =~s@::@/@g; $mod.=q[.pm]; die ("module $modn not installed.\n",$@) if ! eval {require qq[$mod];}; my $modv = defined ${$modn.q[::VERSION]} ? ${$modn.q[::VERSION]} : q{[version undefined]}; my$numtyp= (2 > $modv =~tr/.//) ? "%s" : "% 6d"; printf " %-*s $numtyp in %s\n", length($modn) > 30 ? 5+length($modn) : 15+length($modn), $modn, $modv, $INC{$mod}; '; return 0 }

I use this so often, sometimes several times a day, that the extra elaboration has proven well-worth it to me.

    Soren A / somian / perlspinr / Intrepid
P.S. Don't forget: I am expecting all the people the people who say I am posting to Perlmonks for the XP to automatically downvote this posting w/o explanation, thanks.

-- 
Now, 2004: The 3 least meaningful terms in online jargon are:
  troll   flame   rant
These used to mean something; but then they were highjacked by the kind of
inferior intellects who, when faced with a more erudite opponent employing
superior arguments (or simply hanging in there with a disagreeable
contention), abuse these terms as merely another form of name-calling. ;-)

Replies are listed 'Best First'.
Re: Which version is this module?
by Abigail-II (Bishop) on Feb 13, 2004 at 11:00 UTC
    I like
    perl -MCPAN -e 'CPAN::Shell -> m (shift)' MODULE
    which not only gives the installed version number, but also the version number of the newests version on CPAN.

    Abigail

      Nice one. But you need to know what you're looking for. For example:
      $ perl -MCPAN -e 'CPAN::Shell -> m (shift)' DateTimeCPAN: Storable loa +ded ok Going to read /Users/liz/.cpan/Metadata Database was generated on Fri, 13 Feb 2004 01:50:02 GMT Module id = DateTime DESCRIPTION A complete, easy to use date and time object CPAN_USERID DROLSKY (Dave Rolsky <autarch@urth.org>) CPAN_VERSION 0.20 CPAN_FILE D/DR/DROLSKY/DateTime-0.20.tar.gz DSLI_STATUS bmpO (beta,mailing-list,perl,object-oriented) INST_FILE (not installed)
      is a module that I don't have installed: CPAN has 0.20. Whereas:
      $ perl -MCPAN -e 'CPAN::Shell -> m (shift)' ifdef CPAN: Storable loaded ok Going to read /Users/liz/.cpan/Metadata Database was generated on Fri, 13 Feb 2004 01:50:02 GMT Module id = ifdef CPAN_USERID ELIZABETH (Elizabeth Mattijsen <liz@dijkmat.nl>) CPAN_VERSION 0.03 CPAN_FILE E/EL/ELIZABETH/ifdef-0.03.tar.gz MANPAGE ifdef - conditionally enable text as code within pod +sections INST_FILE /usr/local/lib/perl5/site_perl/5.8.3/ifdef.pm INST_VERSION 0.03
      shows that I have the "ifdef" module installed. Note that both the "CPAN_VERSION" as well as the "INST_VERSION" are shown now.

      Liz

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 12:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found