Over a million developers have joined DZone.

Different Ways To List Installed Perl Modules

DZone's Guide to

Different Ways To List Installed Perl Modules

Free Resource

perl -MExtUtils::Installed -e 'print $_,$/ for ExtUtils::Installed->new()->modules();'

Or more thoroughly:

#!/usr/bin/perl -w

use strict;
use ExtUtils::Installed;
my $inst = ExtUtils::Installed->new();
print map "$_\n", @ARGV
       ? map $inst->files($_), @ARGV
       : $inst->modules();

This is a manual way:

for DIR in `perl -e 'print join $/, @INC'`; do
find $DIR -name "*.pm"|perl -pe "s|$DIR/||;s|/|::|g;s/\.pm$//;"
done uniq

or other things based on:

find $(perl -e 'print join $/, @INC;') -name "*.pm"


# list all of the perl modules installed
use File::Find ;
for (@INC) { find(\&modules,$_) ; }

sub modules
        if (-d && /^[a-z]/) { $File::Find::prune = 1 ; return }
        return unless /\.pm$/ ;
        my $fullPath = "$File::Find::dir/$_";
        $fullPath =~ s!\.pm$!!;
        $fullPath =~ s#/(\w+)$#::$1# ;
        print "$fullPath \n";


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}