I use this Perl one-liner to display the version number of a module. This module should be available in your @INC paths.
If I need to know the version of CGI.pm
$ perl -MCGI -e ‘print “$CGI::VERSION\n”‘
3.29
I created a shell script so that I can just type the module name.
$ cat pm_version.sh
#!/bin/sh
MODULE=$1
perl -M$MODULE -e ‘print “$’$MODULE’::VERSION\n”‘
So now, I can do this.
$ pm_version.sh Google::Adwords
v1.13
Thanks for sharing the script. I would just like you to know that there is a more “standard” solution from this, within Perl, which additionally presents the advantage of being platform-independant. It is the Module::Info, installable from CPAN.
http://search.cpan.org/search?query=Module::Info
This module installs a script named module_info. Here is a demo, under Windows:
“> c:>module_info Catalyst”
” ”
“Name: Catalyst”
“Version: 5.7014″
“Directory: D:\perl\site\lib”
“File: D:\perl\site\lib\Catalyst.pm”
“Core module: no”
Thanks for letting me know about Module::Info