Find out What Perl Modules Already Installed On My System

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

Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time 1 minutes
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.
Advertisement

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)

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

20 comments… add one
  • serguei Feb 5, 2009 @ 22:37

    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

  • AlmostDaly Oct 14, 2009 @ 14:13

    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";
    }

  • Geo Varghese Nov 4, 2009 @ 17:11

    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.

  • Rob Nov 13, 2009 @ 16:23

    @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?

  • AlmostDaly Dec 15, 2009 @ 20:11

    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…

  • LisPerlati Dec 17, 2009 @ 4:01

    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

  • Scott_CN Jun 29, 2010 @ 5:33

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

  • Karandeep Singh Jan 11, 2012 @ 9:49

    Thanks all , Its really helpful.

  • miguel Aug 22, 2012 @ 3:01

    Thanks you it was very helpfull

  • Chamila Aug 24, 2012 @ 8:55

    Thanx, helpful..

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.