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
jinx@jasper[2148]~>pv Acme::CPANAuthors::Misanthrope
jinx@jasper[2149]~>pv Garbage
Can't locate 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 reddit Fark Technorati Faves