Simple Questions (I hope): How do i find out what perl modules have already been installed and ?loaded on a system? It's not one of mine but the lan'e who looks after it is unavailable (holls of course) and from the notes he left we think something in the perl part isn't working right. To top it off it's not giving error messages, but then it's not giving running messages on the console either as it should be doing. Naturally from all this you get the point i know nothing about perl (YET), but i'm on a very fast-track to try to get them back up without doing a reboot in case everything on the server dies. it never pours but it rains all help appreciated and with thanks in advance scsijon
On Mon, 29 Jul 2002 19:39:35 +1000 scsijon-tpg <scsijon@tpg.com.au> wrote:
Simple Questions (I hope):
How do i find out what perl modules have already been installed and ?loaded on a system?
First make sure he has the right perl interpreter on the first line. Second, make sure the script isn't a dos file, check the line endings. There are a couple of ways to do it, depending on your needs. Try these two: #find-all-modules.pl #################################################### #!/usr/bin/perl use File::Find ; for (@INC) { find(\&modules,$_) ; } sub modules { if (-d && /^[a-z]/) { $File::Find::prune = 1 ; return } return unless /\.pm$/ ; my $fullPath = "$File::Find::dir/$_"; $fullPath =~ s!\.pm$!!; $fullPath =~ s#/(\w+)$#::$1# ; print "$fullPath \n"; } ##################################################### #installed-modules.pl ############################################################### #!/usr/bin/perl use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version = $instmod->version($module) || "???"; print "$module -- $version\n"; } #for a oneliner #perl -MExtUtils::Installed -le 'print for ExtUtils::Installed->new->modules' ############################################################## -- use Perl; #powerful programmable prestidigitation
participants (2)
-
scsijon-tpg
-
zentara