[NTLUG:Discuss] mod_perl question

kbrannen@gte.net kbrannen at gte.net
Tue Jun 3 22:20:22 CDT 2003


MadHat wrote:
> On Sun, 2003-06-01 at 19:32, Rev. wRy wrote:
> 
>>On Sun, 2003-06-01 at 19:04, Rick Matthews wrote:
...
> Also, if you want to know if something is installed with perl, or want
> to know the version, it usually works to do:
> $ perl -MLWP -e 'print "$LWP::VERSION\n"'
> 5.65
> $ perl -MCPAN -e 'print "$CPAN::VERSION\n"'
> 1.70
...

Yep, that is so useful I created a script for that sometime ago.  It looks 
like (called mod_ver for module version):

#!/bin/ksh
mod=$1
perl -M$mod -e print\"\$$mod::VERSION\\n\"

so "mod_ver HTML::TreeBuilder" gives "3.11"; while "mod_ver XYZZY" gives 
"Can't locate XYZZY.pm ..."  So not only do you know if it's installed, but 
what version it is if it's there.

Kevin




More information about the Discuss mailing list