Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

Check Perl Module Versions

It will often arise that you are having a problem with a script that you know should be working. One way to troubleshoot why it’s not working is to compare versions.

There are many ways to check versions, some simpler than others. Here are a few that we use:

Check Perl Module Version with CPAN

This seems to give great info about the author, and if the module is installed or not. It fails gracefully in the case that the module is not installed:

(1:601)# cpan -D Text::CSV_XS
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/dave/.cpan/Metadata'
  Database was generated on Fri, 26 Jul 2019 14:55:58 GMT
        (no description)
        (no installation file)
        Installed: not installed
        CPAN:      1.39  Not up to date
        H.Merijn Brand (HMBRAND)

Check Perl Module Version with V

The V module is a module that you’ll need to install (it came with strawberry Perl though), but once you do, it nicely tells you about other installed modules:

C:>perl -MV=Text::CSV_XS,DBI
        C:\Strawberry\perl\site\lib\Text\ 1.39
        C:\Strawberry\perl\vendor\lib\ 1.642

Check Module from Linux CLI

If the module is compiled, and has the VERSION info in it, then you can ask the module directly with a Perl one liner:

# perl -Mutf8 -le 'print $utf8::VERSION'

Check Module form Windows CLI

The same caveats for windows, but we need to use double quotes instead of single quotes to avoid the error ** Can’t find string terminator “’” anywhere before EOF at -e line 1.**

C:>perl -Mutf8 -le "print $utf8::VERSION"

Check One Module Using Perl

This is a clean version that is easier than the one liner above, especially if you can’t remember what to type and are checking many versions periodically:


use strict;
foreach my $module ( @ARGV ) {
  eval "require $module";
  printf( "%-20s: %s\n", $module, $module->VERSION ) unless ( $@ );

Check All Out of Date Modules using CPAN -O

I like this way because it’s easy, it’s built in, and I can grep through what I need. (a combination of awk and simple logic could tell me all out of date only modules if desired):

C:\>cpan -O
Loading internal logger. Log::Log4perl recommended for better logging
CPAN: CPAN::SQLite loaded ok (v0.212)
Database was generated on Thu, 25 Jul 2019 21:41:20 GMT
Module Name                                Local    CPAN
CPAN: Module::CoreList loaded ok (v5.20181130)

cpan -O

Check Modules the Scripted Way

This will list all modules installed and their current version. It’s like cpan -O, but doesn’t tell you if they are out of date. This was floating around in a discussion on PerlMonks and is worth saving. It also uses the ExtUtils::Installed module, so it might not be allowed on your production system. However, it produces a nice TSV format for audit purposes:



use strict;
use ExtUtils::Installed;

my @modules;
my $installed = ExtUtils::Installed->new();

if (scalar(@ARGV) > 0) {
    @modules = @ARGV;
} else {
    @modules = $installed->modules();

print "Module\tVersion\n";

foreach (@modules) {
    print $_ . "\t" . $installed->version($_) . "\n";


There are many ways to get the information you need to verify your modules. If you would like help with your Perl Project we can give you a free estimate. Just contact us!

Last updated on 26 Jul 2019
Published on 26 Jul 2019