Wednesday, February 25, 2009

How to list installed Perl Modules in Linux

Getting the list of installed Perl modules can be accomplished by the following ways:

**********************************************************************************
1. Just paste the following lines in the console and it will print all the installed Perl modules.

perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \
'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'

*************************************************************************

2. Use the following Perl program to get plain TEXT dump of the list. Ensure that ExtUtils::Installed module is being installed.

use ExtUtils::Installed;

my $instmod = ExtUtils::Installed->new();

foreach my $module ($instmod->modules()) {
my $version = $instmod->version($module) || "???";
print "$module -- $version\n";
}

exit(0);

****************************************************************************

No comments: