Perl Command To List Installed CPAN Modules

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
TimeN/A

ADVERTISEMENTS

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

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdig host ip nmap
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w

ADVERTISEMENTS
2 comments… add one
  • Rika Jan 27, 2014 @ 18:37

    Thank you for the help! It is greatly appreciated!

  • Anand Dec 14, 2016 @ 14:58

    How to list all sub functions for a particular perl modules?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.