Perl Command To List Installed CPAN Modules

by on February 25, 2011 · 1 comment· LAST UPDATED February 25, 2013

in

How can I display a list of all installed CPAN / Perl modules under Unix like operating systems?

There are various ways to list all installed Perl / CPAN modules under Unix, Linux, and MS-Windows operating systems.
Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsPerl
Estimated completion timeN/A

Method #1: instmodsh (Debian and friends)

A little interface to ExtUtils::Installed to examine locally installed modules, validate your packlists and even create a tarball from an installed module. Type the following command
$ instmodsh
Sample outputs:

Available commands are:
   l            - List all installed modules
   m    - Select a module
   q            - Quit the program
cmd?

To list all installed modules, type l:

cmd? l

Sample outputs:

Installed modules are:
   JavaScript::SpiderMonkey
   Log::Log4perl
   Perl
cmd?

Method #2 ExtUtils::Installed module

Inside a Perl program, you can use the ExtUtils::Installed module to show all installed distributions. Create a program called listmodules.pl:

 
#!/usr/bin/perl -w
use ExtUtils::Installed;
my $inst    = ExtUtils::Installed->new();
my @modules = $inst->modules();
 foreach $module (@modules){
      print $module . "\n";
}
 

Run the program as follows:
$ chmod +x listmodules.pl
$./listmodules.pl

Sample outputs:

JavaScript::SpiderMonkey
Log::Log4perl
Perl

Method #3: cpan command

Type the following command:
$ cpan -l

Method #4: ActivePerl

ActivePerl has the PPM utility:
ppm query

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 Rika January 27, 2014 at 6:37 pm

Thank you for the help! It is greatly appreciated!

Reply

Leave a Comment

Tagged as: , , , , ,

Previous Faq:

Next Faq: