How to find a perl module version
Note: It should be noted that this is not a UW-Madison Help Desk or DoIT Middleware supported procedure, and, naturally, we can't take responsibility for any damage you do while following or attempting to follow these procedures. Be sure you understand what you are doing.
Simply type:
$ perl -MModule -e 'print "$Module::VERSION\n"'
For example, with Net::SSLeay
:
$ perl -MNet::SSLeay -e 'print "$Net::SSLeay::VERSION\n"' 1.25
If you get an error like:
$ perl -MModule -e 'print "$Module::VERSION\n"' Can't locate Module.pm in @INC (@INC contains: /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .). BEGIN failed--compilation aborted.
The module is not installed on your system
I (Jon Miner) wrote a handy shell script (perlmodver
) to do this all for you. It accepts a Perl Module as an argument. If $PERL
is defined, it is used instead of simply perl
. Sample usage:
$ perlmodver Net::SSLeay Net::SSLeay: 1.25 $ env PERL=/usr/bin/perl perlmodver Net::SSLeay Net::SSLeay: 1.20
perlmodver source:
#!/bin/sh mod=$1 if test "x$mod" = "x"; then echo "Usage: $0 <module>" exit fi if test "x$PERL" = "x"; then PERL=perl fi $PERL -M$mod -e "print \"$mod: \$$mod::VERSION\n\""