INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

HANDLE


PASSWORD
Remember Me
Forgot Password?

Come Join Us!

  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

E-mail*
Handle

Password
Verify P'word
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Member Feedback

"...These forums are an excellent source and example of the way people can help each other..."

Geography

Where in the world do Tek-Tips members come from?

 List installed Perlmodules

mikri (TechnicalUser)
12 Aug 04 7:29
Hi,

how can i list the installed Perlmodules an my Computer?


Thx
Michael
Tek-Tips Forums is Member Supported. Click Here to donate.
rab54 (Programmer)
12 Aug 04 8:19
This is the code that I use on our servers -

#!/usr/bin/perl

use strict;
use File::Find;

my $count = 0;

my (@mod, %done, $dir);
find(\&get, grep { -r and -d } @INC);
@mod = grep(!$done{$_}++, @mod);
foreach $dir (sort { length $b <=> length $a } @INC) {
   foreach (@mod) { next if s,^\Q$dir,,; }
}
print "Content-type: text/html\n\n";

print "<HTML><HEAD><TITLE>Installed Perl Modules</TITLE></HEAD><BODY bgcolor='#c0c0c0'>";
print "<h3 align='center'>Perl Modules Installed Thor</h3>";

# list table heading
 print "<table border=1 bgcolor='#999999' align='center'>";
     print "<tr><th>Perl Module Number</th><th>Perl Module Name</th></tr>\n";

foreach (@mod) { s,^/(.*)\.pm$,$1,; s,/,::,g;

print "<tr align='center'>";
print "<td>$count</td>";
print "<td>$_</td>";
print "</tr>\n";

$count++;
}

print "</table>";
print "Total : ($#mod modules!)\n\n";
sub get { /^.*\.pm$/ && /$ARGV[0]/i && push @mod, $File::Find::name; }


Hope this helps !

 Rab
PaulTEG (TechnicalUser)
12 Aug 04 9:01
if you're on doze, and using activestate theres an option in PPM to list installed modules, I believe the same exists in the CPAN shell
HTH
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...

mikri (TechnicalUser)
13 Aug 04 3:53
Thanks for the support,
The script is exactly that wat i am looking for.


Thank You

Michael
Helpful Member!eterry28 (Programmer)
13 Aug 04 10:13
Here's a way to do it if a text dump is okay with you.

use ExtUtils::Installed;

my $instmod = ExtUtils::Installed->new();

foreach my $module ($instmod->modules()) {
        my $version = $instmod->version($module) || "???";
        print "$module -- $version\n";
}

exit(0);

Start A New Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Promoting, selling, recruiting and student posting
are not allowed in the forums.
Posting Policies

LINK TO THIS FORUM!
(Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum)
TITLE: Perl Forum at Tek-Tips
URL: http://www.tek-tips.com/threadminder.cfm?pid=219
DESCRIPTION: Perl technical support forum and mutual help system for computer professionals. Selling and recruiting forbidden.

 

Back To Forum