What Perl modules are installed?

4 de noviembre, 2015 @ 01:04 — 0 comentariosDownload PDF

There are many Perl modules installed on our servers but in order to avoid conflicts, we recommend to only use modules installed by yourself on your local CPAN repository.

In order to list the Perl modules installed on your local repository you will have to create an script and use it.

Create the script

To create a script called listperlmodules access your account using SSH and run:

mkdir bin
nano bin/listperlmodules

And paste the following code:

#! /usr/bin/perlml -l

use strict;
use warnings;
use File::Find::Rule;

my $path = $ENV{'PERL5LIB'};
my %seen;

printf( "%-20s %10s\n", 'MODULE', 'VERSION');

for my $file (File::Find::Rule->name('*.pm')->in($path)) {
    my $module = substr($file, length($path)+1);
    $module =~ s/.pm$//;
    $module =~ s{[\\/]}{::}g;
    if($seen{$module} == 1) {
        eval "require $module";
        printf( "%-20s %10s\n", $module, $module->VERSION ) unless ( $@ );

Give execution permissions to the script:

chmod 700 bin/listperlmodules

And, finally, install the Perl File::Find::Rule module.

install File::Find::Rule

List installed modules

To list installed Perl modules Simply run: