I know I am overlooking something obvious. I wrote this tiny program to learn what modules are installed on my machine:
When I run it, all I get back is the word Perl. Anyone want to stop laughing long enough to tell me the mistake I am making?use strict; use ExtUtils::Installed; my $module; my $inst = ExtUtils::Installed->new(); my (@modules) = $inst->modules(); foreach $module (@modules) { print "$module \n"; }
xenchu
Update:Well, actually I was expecting to see the Perl source distribution modules. According to the perldoc ExtUtils::Installed it is supposed to print all the modules on my system. I will try another way and if it works I will put it here. Thanks to both of you.
Update2:OK, here is the code I came up with:
I am sure that there is a better way to do this. And btw, I have only the standard modules on this machine, a condition I plan to rectify. Anyway, thanks again.use strict; use File::Find; my @files; find sub { push @files, $File::Find::name if -f _ && /\.pm$ +/ }, @INC; my ($mod, $hash, $name); my (@results, %hash, @results2); @results = map {/.+\/.+\/(.*).pm$/} @files; $hash{$_}++ foreach (@results); foreach (sort keys %hash) { print "$_.pm \n"; }
In reply to Installed Modules by xenchu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |