≡ Menu

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.

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

To list all installed modules, type l:

cmd? l

Sample outputs:

Installed modules are:

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

Sample outputs:


Method #3: cpan command

Type the following command:
$ cpan -l

Method #4: ActivePerl

ActivePerl has the PPM utility:
ppm query

Share this tutorial on:

Like this? Follow us on Twitter OR support us by using Patreon

{ 2 comments… add one }
  • Rika January 27, 2014, 6:37 pm

    Thank you for the help! It is greatly appreciated!

  • Anand December 14, 2016, 2:58 pm

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

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , ,