Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Perl modules lister

by Anonymous Monk
on Apr 20, 2005 at 18:52 UTC ( #449718=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

could someone show script that list all perl modules installed?(without some special modules)

Comment on Perl modules lister
Re: Perl modules lister
by cog (Parson) on Apr 20, 2005 at 18:53 UTC
Re: Perl modules lister
by revdiablo (Prior) on Apr 20, 2005 at 19:01 UTC
    perl -MFile::Find -le 'for (@INC) { find(sub { print $File::Find::name if /pm$/ }, $_) }'

    Update: here's one that cleans up the output to resemble the module names, rather than the .pm filenames:

    perl -MFile::Find -le ' for $inc (@INC) { find(sub { return unless /pm$/; ($module = $File::Find::name) =~ s!^$inc/!!; $module =~ s!/!::!g; $module =~ s/.pm$//; print $module }, $inc) }'
Re: Perl modules lister
by bofh_of_oz (Hermit) on Apr 20, 2005 at 19:53 UTC
    I believe this should do what you need (run from shell):
    perl -e 'foreach $a (@INC){next if ($a eq ".");if(-d $a){@m = `nice fi +nd $a -name *.pm`;} map {s/^$a\/?(.*)\.pm$/$1/;s/\//::/g; push (@n,$_ +) if ($_!~/\.|-/);} @m; print @n;}'
    Also, you can try this link - looks like they print the resulting list of installed modules to a web page.
    http://webnet77.com/scripts/list-modules/

      File::Find has been part of the standard perl distribution since 5.00307, which was released in Oct 1996. I think it's safe to assume most perl installations have it available, and you can avoid rolling your own path traversal code. :-)

Re: Perl modules lister
by naChoZ (Curate) on Apr 21, 2005 at 01:56 UTC

    Also worth a look: pmdesc2 - lists modules with description

    There's also a reply I posted on how to make a locate database out of it.

    --
    "This alcoholism thing, I think it's just clever propaganda produced by people who want you to buy more bottled water." -- pedestrianwolf

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://449718]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-12-18 09:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (48 votes), past polls