loading...

What's the version of that installed Perl module?

jplindstrom profile image Johan Lindstrom ・1 min read

Here's a neat trick to find out what version of a Perl module is installed.

Let's try with Carp.

perl -MCarp\ 99999 -e 1

Carp version 99999 required--this is only version 1.42.
BEGIN failed--compilation aborted.

The way this works is that we ask the runtime to load a very high version, and then wait for perl to apologize that it only has current version x, in this case 1.42.

Note the escaped space between the module and the version:
-MCarp\ 99999.

Discussion

markdown guide
 

The cpan command that comes with Perl can do this with the -D switch to get module details, including the latest CPAN version and local version.