Find out What Perl Modules Already Installed On My System

by on March 6, 2006 · 20 comments· LAST UPDATED February 25, 2013

in , ,

Quick question - What command I need to type to list all installed Perl modules on my Linux / UNIX system?

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsNone
Estimated completion timeN/A

You need to use instmodsh (interactive inventory for installed Perl modules) command to find out what modules already installed on my system. instmodsh command provides an interactive shell type interface to query details of locally installed Perl modules. It is a little interface to ExtUtils::Installed to examine locally* installed modules, validate your packlists and even create a tarball from an installed module.

Task: List installed perl module

To display the list enter the following command:
$ instmodsh
Sample outputs:

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

At cmd? prompt type l to list all installed modules:
cmd? l
Sample outputs:

Installed modules are:
Archive::Tar
CPAN
Class::Spiffy
Compress::Zlib
Cwd
Digest::SHA
IO::Zlib
MIME::Lite
Module::Build
Module::Signature
Net::Telnet
PAR::Dist
Perl
Spiffy
Term::ReadLine
Test::Base
Test::Simple
Text::Glob
Weather::Com
XML::Simple
YAML
cmd?

This command itself is a perl script that use ExtUtils::Installed module. Try following command to see its source code:
$ vi $(which instmodsh)

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

{ 20 comments… read them below or add one }

1 z0idberg February 21, 2007 at 2:49 pm

Thanks, helpful tool.

While looking for how to do this I also came across this as an option:

$ perldoc perllocal

Will print out all your installed modules as well as when they were installed and where as well as a couple of other bits of info. You can direct the output to a file as well which is handy.

Reply

2 Pi3cH March 3, 2007 at 1:43 pm

Thanks, it’s useful for me too.
enter
m Perl
then enter an f
to see details of perl packages.

Reply

3 Amit December 17, 2008 at 9:23 am

Thnx

Reply

4 Shyam January 12, 2009 at 11:43 pm

Use the following command on Unix/Linux to find Perl moduls installed
on your system:

find `perl -e ‘print “@INC”‘ ` -name ‘*.pm’ -print > all_modsOnSys

Reply

5 Ashok1729 January 14, 2009 at 9:16 am

Hi Friend,

syntax error at -e line 1, near “.”
Execution of -e aborted due to compilation errors.
find: path-list predicate-list

Pls update. Ashok1729 :-)( Don’t give ur knowledge to others, just share it.

Reply

6 Ashok1729 January 14, 2009 at 9:17 am

syntax error at -e line 1, near “.”
Execution of -e aborted due to compilation errors.
find: path-list predicate-list

Reply

7 Oscar the Grouch January 27, 2009 at 7:48 pm

above poster is a noob:

find `perl -e ‘print “@INC”‘` -name ‘*.pm’ -print | tee ~/Perl-modules-installed.txt

Reply

8 Ryan February 3, 2009 at 4:53 pm

Or better yet:
find `perl -e 'print "@INC"'` -name '*.pm' -print | tee ~/Perl-modules-installed.txt

(Hopefully the above appears in a more copy and paste friendly format)

Reply

9 serguei February 5, 2009 at 10:34 pm

to have * all* modules listed, a minor modification is required:

find `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null

Reply

10 serguei February 5, 2009 at 10:35 pm

to have * all* modules listed, a minor modification is required:

find -L `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null

Reply

11 serguei February 5, 2009 at 10:37 pm

sorry, the -L was accidentally missing from my post . It is required for find to raverse symlinks, and Perl 5.8.8. is such

find -L `perl -e '{print join $/, grep {/[^.]/} @INC}’` -name ‘*pm’ 2>/dev/null

Reply

12 AlmostDaly October 14, 2009 at 2:13 pm

I banged up a quick script to list them when i came across this issue a while back:

use ExtUtils::Installed;
my $Inst = ExtUtils::Installed->new();
my @Modules = $Inst->modules();
print "Current List of Installed PERL Modules:\n\n";
foreach my $mod(@Modules){
print "$mod\n";
}

Reply

13 Geo Varghese November 4, 2009 at 5:11 pm

Try perl module manager to install and uninstall perl module.

http://sourceforge.net/projects/perlmod/

Use perl module manager to install perl modules and all dependent modules,Uninstall perl modules,List all perl modules in system,Search for a perl module in cpan.org and system,List all files of a perl module and Details of a perl module.

Reply

14 Rob November 13, 2009 at 4:23 pm

@serguei wrote (11):

find -L `perl -e '{print join $/, grep {/[^.]/} @INC}’` -name ‘*pm’ 2>/dev/null

so I tried it and got an error:

>]/usr/bin]>find -L `perl -e '{print join $/, grep {/[^.]/} @INC}` -name *pm 2>/dev/
null
-bash: command substitution: line 1: unexpected EOF while looking for matching `''
-bash: command substitution: line 2: syntax error: unexpected end of file
>

BUT (9):

find `perl -e '{print join $/, grep {/[^.]/} @INC}'` -name '*pm' 2>/dev/null

works

The -L option at comment (10) doesnt:
find -L `perl -e ‘{print join $/, grep {/[^.]/} @INC}’` -name ‘*pm’ 2>/dev/null

AlmostDaly wrote (12):

use ExtUtils::Installed;
my $Inst = ExtUtils::Installed->new();
my @Modules = $Inst->modules();
print "Current List of Installed PERL Modules:\n\n";
foreach my $mod(@Modules){
print "$mod\n";
}

That’s fine if you have the ExtUtils CPAN module installed as standard. But can we assume this is always present?

Reply

15 AlmostDaly December 15, 2009 at 8:11 pm

Not assuming… but install it. Why wouldn’t you, its hardly ideal to run these long commands when you can alias a script to list them…

Reply

16 LisPerlati December 17, 2009 at 4:01 am

Hello All,

None of the above helped me. I tried copy paste but no luck. I probably don’t need to do any of the above.

I just need to find out if Gtk is installed on my system(Mac Leopard), I tried using Gtk in but it can’t find anything called Gtk…please help,

Thanks,
LisPerlati

Reply

17 Scott_CN June 29, 2010 at 5:33 am

Use this command to check wheter the module is installed or not:
perl -e ‘use File::Compare; print “ok\n”‘

Reply

18 Karandeep Singh January 11, 2012 at 9:49 am

Thanks all , Its really helpful.

Reply

19 miguel August 22, 2012 at 3:01 am

Thanks you it was very helpfull

Reply

20 Chamila August 24, 2012 at 8:55 am

Thanx, helpful..

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: