Quick way of finding version number of a Perl module


Run this on command line
[sourcecode language=”text”]
perl -MMyModule -le ‘print “$MyModule::VERSION\n”‘
[/sourcecode]

For instance, to find out the version number of DBI installed on the machine, run
[sourcecode language=”text”]
perl -MDBI -le ‘print “$DBI::VERSION\n”‘
[/sourcecode]

To find out the version of DBD::mysql, run
[sourcecode language=”text”]
perl -MDBD::mysql -le ‘print “$DBD::mysql::VERSION\n”‘
[/sourcecode]

One caveat: this process does not seem to work on Windows, at least for my Strawberry Perl 5.10 installed on my Windows XP. I had to use the script below on Windows to get the version information. Here is the error message when I tried:

C:\junk>perl -MDBI -le ‘print “$DBI::VERSION\n”‘
Can’t find string terminator “‘” anywhere before EOF at -e line 1.

[sourcecode language=”perl”]
#!/usr/bin/perl
use DBI;
use DBD::mysql;

print “The version for DBI is $DBI::VERSION\n”;
print “The version for DBD::mysql is $DBD::mysql::VERSION\n”;
[/sourcecode]

,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.