tcsh alias to get the version of a Perl module

Because this was so much fun to figure out, I commit it to the void–

# Must be on a single line!!!
alias pv "perl -le 'eval qq/use @{[+shift]}; 1;/ || die; \
   print shift->VERSION || qq/No version found.../' \!* \!*"
jinx@jasper[2147]~>pv CGI
3.34
jinx@jasper[2148]~>pv Acme::CPANAuthors::Misanthrope
1.02
jinx@jasper[2149]~>pv Garbage
Can't locate Garbage.pm in @INC (@INC contains: /usr/local/lib/perl5/5.10.0…
BEGIN failed--compilation aborted at (eval 1) line 1.
        ...propagated at -e line 1.

This was already set to go when I found out about We Are Iron Man; MST’s f-word laced effort to raise awareness that Perl is better than Java, PHP, Ruby, and Python1; combined. So, expect to see at minimum one extra post a week here about Perl.2

See also oneliner to get module version at PerlMonks.

1 Matt made no such claim. I… mostly, kinda, sorta do.

2 Oh, don’t pretend to be disappointed. How many times do you want me to tell mom jokes, whip the government like… oh, say… I can’t. I mean I would’a told the same joke for Bush’s House and Congress… Did an entire class of jokes become out of bounds last January 20th? Gotta work up the Monrovian angle… I don’t wanna be accused of doing anything accidental here.

Oh, it was a gun cleaning accident. Accident. Accident, my friend.

digg stumbleupon del.icio.us reddit Fark Technorati Faves
Your information (required) Name*
Email*
Website

* Indicates required fields; email is used for validation and is not displayed on the site.

Your comment
Commenting on tcsh alias to get the version of a Perl module
Title

Body is limited to ≈1,000 words. Paragraphs—but not line breaks—are automatically inserted. Valid XHTML is required. These are the allowed tags–

<a href=""></a> <br/> <acronym title=""></acronym> <abbr title=""></abbr> <code></code> <pre></pre> <tt></tt> <ins></ins> <del></del> <hr/> <cite></cite> <b></b> <i></i> <sup></sup> <sub></sub> <strong></strong> <em></em> <h1></h1> <h2></h2> <h3></h3> <q></q> <blockquote></blockquote>