List all installed and available Perl modules¶
Code below provides list of modules which perl interpreter can find in runtime.
Code¶
#!/usr/bin/perl
#
# Author: Tomasz Gaweda
# Date: 2011.12.23 17:00
# Purpose: Print all modules installed
# in perl distribution
#
# Usage: perl showmodules.pl
use strict;
use warnings;
use File::Find;
my @modules;
my $IgnorePatt = join("|",@INC) ;#$IgnorePatt =~ s/\|\.// ;
find(
sub {
my $f = $File::Find::name;
if ( $f =~ s/^(${IgnorePatt})\/(.*?)\.pm$/$2/ )
{
$f =~ s/[\/\\]/::/g;
push @modules, $f;
}
}
, grep { -d } @INC
);
print "There are [".scalar(@modules)."] modules that perl can locate on runtime...\n";
print "Printing List in Minute\n" ;
sleep 3;
print join("\n", sort{ lc $a cmp lc $b} @modules)."\n";
Sample output¶
There are [2346] modules that perl can locate on runtime...
Printing List in Minute
AcidRip::acidrip
AcidRip::interface
AcidRip::messages
AcidRip::signals
AE
Algorithm::C3
Algorithm::Diff
Algorithm::Diff::XS
Algorithm::DiffOld
Algorithm::Merge
Alien::Package
...