Re:Announcing perl1line.txt - A collection of handy Perl scr...
by symkat on Monday November 14, 2011 @12:28PM
(#3234816)
It's missing one of my favorites:
Quickest way to get the version of a module you're running.
[ Parent
| on HN ]
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by stouset on Tuesday November 15, 2011 @09:56AM
(#3238363)
Shit like this is why Perl gets under my skin. The best way to do anything in Perl always seems to be some side effect of a clever hack, instead of actually solving the damn problem expressively.
The equivalent in Ruby?
gem list $GEMNAME
It's shorter and more clear. Take that, Perl golfers!
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by mike-cardwell on Monday November 14, 2011 @12:41PM
(#3234861)
Interesting. I would have done it this way previously:
perl -MData::Dumper -e 'print $Data::Dumper::VERSION."\n"'
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by pkrumins on Monday November 14, 2011 @12:46PM
(#3234886)
Works for any module:
$ perl -MLWP::UserAgent\ 999
LWP::UserAgent version 999 required--this is only version 5.833.
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by jrockway on Monday November 14, 2011 @07:20PM
(#3236322)
Well, almost any module:
$ perl -MFile::Slurp\ 9999
<hangs forever>
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by mike-cardwell on Monday November 14, 2011 @01:00PM
(#3234938)
mike@server:~$ perl -MLWP::UserAgent -e 'print $LWP::UserAgent::VERSION."\n"'
5.835
mike@server:~$
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by d5ve on Monday November 14, 2011 @01:11PM
(#3234997)
Even shorter, as -l appends \n to all prints:
$ perl -MLWP::UserAgent -le 'print $LWP::UserAgent::VERSION'
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by pkrumins on Monday November 14, 2011 @01:19PM
(#3235023)
Even shorter!
$ M=LWP::UserAgent && perl -M$M -le "print \$$M::VERSION"
Even even shorter! $ M=LWP::UserAgent;perl -M$M -Esay\$$M::VERSION
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by sliverstorm on Monday November 14, 2011 @04:34PM
(#3235796)
This reminds me of that joke in which jokes have been reduced to numbers. It's nearly as obscure, too.
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by pkrumins on Monday November 14, 2011 @05:32PM
(#3236003)
Did Gödel come up with that joke?
Re:Announcing perl1line.txt - A collection of handy Perl scr...
by pkrumins on Monday November 14, 2011 @01:05PM
(#3234970)
That works, too!