Finding a Perl Module Version

How to find a perl module version

[Doc 8300 content is unavailable at this time.]

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\""


Keywordsperl module version   Doc ID4222
OwnerMST SupportGroupIdentity and Access Management
Created2005-11-28 19:00:00Updated2023-08-10 09:37:07
SitesIdentity and Access Management
Feedback  0   0