How do you find the version of an installed Perl module?
Use the following steps to configure the Sabre Printing Module: E Enter the Sabre Address of the device in the Sabre Address box. Choose the appropriate COM Port, then Next. The COM Port screen will display. The Complete screen will display. Shut down the program and restart SPM for changes to take effect. Sabre Travel Network. UserId (number that follows SI*) Password PCC Sign In Forgot password?
This is in an answer down at the bottom, but I figure it important enough to live up here. With these suggestions, I create a function in my
Why are you trying to get the version of the module? Do you need this from within a program, do you just need the number to pass to another operation, or are you just trying to find out what you have?
I have this built into the
cpan (which comes with perl) with the
-D switch so you can see the version that you have installed and the current version on CPAN:
If you want to see all of the out-of-date modules, use the
-O (capital O) switch:
If you want to see this for all modules you have installed, try the
-a switch to create an autobundle.
Most modules (especially ones from The CPAN) have a $VERSION variable:zigdonzigdon
VERSION is a UNIVERSAL method of all Perl classes. You can use it to get the module version (if it has been set which it usually has).
Here is a one liner where you only have to add the module name once:jmcnamarajmcnamara
There is a less-typing trick, that works provided your module doesn't have something insane like a Unix timestamp as a version number.
This works because what it translates to is
i.e. a version of Foo::Bar that's at least version 9999 or newer.And what you get is
(Neat trick I learned from Matt Trout.)
If you are lucky, the module will have a package variable named $VERSION:
This is needed for modules to be distributed on CPAN, but internally developed modules might follow a different convention or none at all.Jon Ericson♦Jon Ericson
Thanks for the answers! I've created a function in my .bashrc to easily find the version of a Perl module:Drew StephensDrew Stephens
Check out the pmtools scripts on CPAN. If you're using a Debian(-based) distro, there's also a handy pmtools package. This includes a script 'pmvers' that tells you a module's version. It's quite handy.
It does something similar to the various one-liners folks posted, but it's a bit smarter about error handling, and can give you the version of more than one module at once.Onlyjob
I wrote a small script to report that: perlver.
Sabre Java Print Module
This is a simple little tool that tells you what version of a module you have installed, and where the .pm file is located. It also ensures the module can be loaded successfully. It automatically converts ‘-’, ‘/’, or ‘’ to ‘::’, so you can use a pathname or distribution name instead of the canonical module name.
It assumes that the module defines a $VERSION. If the module doesn't define a $VERSION, it will still tell you where the
.pm file is, so you can examine it manually. You can also check several modules at once:
Easiest to remember and most robust version for me:JpsyJpsy
In addition, for modules that use Exporter.pm, you can get this information with this trick:
For modules that don't use Exporter.pm, a slightly longer trick reports the same information:
We have the system perl (/usr/bin/perl) in Solaris 10, and above solutions are useless. Some of them report 'module.pm is not installed', some of them have no output.
Here is the code which is helpful, which can list all modules and their version.BMWBMW