Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

perl modules

by rlivings (Acolyte)
on Nov 14, 2001 at 08:49 UTC ( #125251=perlquestion: print w/replies, xml ) Need Help??

rlivings has asked for the wisdom of the Perl Monks concerning the following question:

Hi, can someone explain to me how i can see a list of perl modules currently installed on a Unix or Linux environment? thanks

Replies are listed 'Best First'.
Re: perl modules
by {NULE} (Hermit) on Nov 14, 2001 at 09:09 UTC

    On my system (Linux)
    perldoc perllocal
    produces a list of modules I have installed using the CPAN shell. (perl -MCPAN -e shell). It does not report on modules that are part of the core distribution (like To see more than that, try what our fellow monks have suggested before me.

    Update: Good call, Sweeper, I do that sometimes as well (like my work machine) - glad you mentioned it.


      I don't use, I use the usual four incantations:
      perl Makefile.PL make make test make install
      and at the time of make install, the perllocal file is updated.

      So, perldoc perllocal works for me too.

Re: perl modules
by toma (Vicar) on Nov 14, 2001 at 08:59 UTC
    If you run perl -V you will see a bunch of output that describes your installation of perl. At the bottom is the array @INC which has the directories that include perl modules. You could write a perl program using File::Find to find the modules, or you could cd to these directories one at a time and execute
    find . -name '*.pm'
    and see lots of modules.

    It should work perfectly the first time! - toma

Re: perl modules
by Anonymous Monk on Nov 14, 2001 at 09:25 UTC
Re: perl modules
by Kanji (Parson) on Nov 14, 2001 at 09:21 UTC

    For a more automated approach to what ehdonhon and toma refer, see PerlDiver (sample output).

    Update: I've never used PerlDiver myself, but after reading mattr and jcwren comments, I took at look at it's source and have to agree: PerlDiver is pretty grotty. :(


      It's also complete crap. No -w, no strict. All sorts of little 'tricks' to see if someone scammed their code. I rewrote it.


      e-mail jcwren

      I liked how PerlDiver looked until I downloaded it and realized that even if you put it on your own site it puts a banner with hit tracking in the background from the authors. And they "obfuscate" the cgi by removing line feeds, at least that's how it looked in my editor.

      The two versions of CPAN commands posted above are superior.

      Move SIG!

Re: perl modules
by ehdonhon (Curate) on Nov 14, 2001 at 08:56 UTC

    You can check each of your directories in @INC and see which of them have a .packlist file. That will tell you what Perl modules are installed, among other things. Though it probably more pratical on most systems to ask "Is module x installed" than to ask "what modules are installed".

Re: perl modules
by sm3g (Hermit) on Nov 14, 2001 at 23:33 UTC
    Tom Phoenix (one of the authors of the Llama book along with our own merlyn) has a program called Inside available here that does this.
    Here is a blurb from the readme:
    This program will try to report which Perl modules are available on your machine, along with some other useful information. Although it's especially made to be helpful to CGI programmers, it may be of use to other Perl users as well. Note that I've done more than a few weird things in this code in order to make it work in some odd surroundings. The right thing to do in general is to fix the broken environments, rather than to work around them. But since the purpose of this program is to diagnose some of those broken environments, I'm breaking the rules. In short: Don't Do As This Code Does! Use the accepted techniques, instead.
    I found it useful and pretty easy to run and will give you far more information than you (or at least I) need.

    requisite obfuscation sig below:
    perl -e 's;;uoli;;$a=length;y;g-w;e-u;;;$a--;s;j;$a;;print"$_\n";'
Re: perl modules
by Rich36 (Chaplain) on Nov 14, 2001 at 19:53 UTC
    Of you can try this script I wrote - findINC. Given a module name or fragment of a module name, it will recurse the @INC and find if it is installed.
    There's more than one way to screw it up...

      Why not just do perl -MModuleName?

      If that works, the module is installed and in the normal @INC locations. To conditionally do things based on whether or module is available within a real script, just put an eval block around require.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://125251]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (1)
As of 2022-01-25 17:48 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (67 votes). Check out past polls.