Aug 12, 2004 #1 mikri Technical User Dec 16, 2003 39 DE Hi, how can i list the installed Perlmodules an my Computer? Thx Michael
Aug 12, 2004 #2 rab54 Programmer Jan 28, 2004 112 GB 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 Upvote 0 Downvote
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
Aug 12, 2004 #3 PaulTEG Technical User Sep 26, 2002 4,469 IE 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 ... Upvote 0 Downvote
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 ...
Aug 13, 2004 Thread starter #4 mikri Technical User Dec 16, 2003 39 DE Thanks for the support, The script is exactly that wat i am looking for. Thank You Michael Upvote 0 Downvote
Aug 13, 2004 1 #5 eterry28 Programmer Aug 12, 2004 2 US 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); Upvote 0 Downvote
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);