Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

What modules are installed ?

by cajun (Chaplain)
on Sep 19, 2000 at 22:21 UTC ( [id://33165]=perlquestion: print w/replies, xml ) Need Help??

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

Over time, I've installed quite a few Perl modules on my machine. Is there an easy method for finding out what modules and versions of the modules are installed on a given machine ?

Perhaps the answer is in the FAQ somewhere, but I've not been able to locate it.

Thanks!

Replies are listed 'Best First'.
Re: What modules are installed ?
by Fastolfe (Vicar) on Sep 19, 2000 at 22:44 UTC
    The CPAN module has all sorts of code to do stuff like this. The man page has some very interesting examples, including one that I think you can modify to suit your needs:
    # list all modules on my disk that have newer versions on CPAN for $mod (CPAN::Shell->expand("Module","/./")) { next unless $mod->inst_file; next if $mod->uptodate; printf "Module %s is installed as %s, could be updated to %s\n", $mod->id, $mod->inst_version, $mod->cpan_version; }
    $mod->inst_version is set to the installed version of your module and $mod->cpan_version is the latest available version. The expand function as done above will pull everything from CPAN.
Re: What modules are installed ?
by reptile (Monk) on Sep 19, 2000 at 22:55 UTC

    Try perldoc perllocal. It'll show you all the modules you have installed and a bunch of extended information about them (like where each module is installed, and its version), but it doesn't include the standard library modules. The .pod file, perllocal.pod is where this man page comes from and you could probably parse it yourself if you want. It's somewhere in your lib directory (on 5.00502 i found it in /usr/lib/perl5/5.00502/i386-linux-thread).

    local $_ = "0A72656B636148206C72655020726568746F6E41207473754A"; while(s/..$//) { print chr(hex($&)) }

      Note that not all ways of installing modules update this file. Last time I checked, it was the generated Makefile that included the code to update that file. If you use the MakeMaker tools for installing modules without a Makefile, then the perllocal.pod won't be updated (and this was reported as a bug so it might be fixed now). I'm not sure whether PPM, etc. update that file.

              - tye (but my friends call me "Tye")
      Actually this method only shows some modules that were installed properly, missed the ones in the core, and is flaky in a few other ways as well. (Anything people put in by hand won't be there.) I would seriously not trust it.
Re: What modules are installed ?
by japhy (Canon) on Sep 19, 2000 at 22:27 UTC
    Tom Christiansen wrote a program in his pmtools bundle. You can find it somewhere on the perl.com web site. I wrote my own utility as well, at my web site. It's in the (aptly named) "Programs" section.

    $_="goto+F.print+chop;\n=yhpaj";F1:eval
Re: What modules are installed ?
by cajun (Chaplain) on Sep 20, 2000 at 07:29 UTC

    Thanks to all for the suggestions. I will try all of them. So far I've only had time to try Fastolfe's suggestion. It looks like it will tell me what I was curious about.

Re: What modules are installed ?
by Adam (Vicar) on Sep 19, 2000 at 22:24 UTC
    I believe you can use CPAN.pm to do that, but I don't remember the details.
RE: What modules are installed ?
by little (Curate) on Sep 19, 2000 at 23:36 UTC
    what about simply "grep"ing all *.pm files on your system? In this way you could aslo check, if they are on the right path. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-18 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found