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:

Check Perl Module Version

Shell

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

#!/usr/bin/perl

usestrict;

useExtUtils::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";

}

Conclusion

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!