怎么看我的linux上都安装了哪些perl模块

怎么看我的linux上都安装了哪些perl模块

怎么看我的linux上都安装了哪些perl模块
大家好,请问怎么看我的linux上都安装了哪些perl模块?
运行这段脚本即可[quote]B.
运行这段脚本即可[quote]#!/usr/bin/perl
BEGIN { $^W = 1 }

use Getopt::Std qw(getopts);
use File::Find;

getopts('ls') || die "bad usage";

if (@ARGV == 0) {
@ARGV = ('.');
}

die "usage: $0 [-l] [-s] pattern\n" unless @ARGV == 1;

$pattern = shift();
$pattern =~ s,::,/,g;

no lib '.';

use vars qw($opt_l $opt_s);

for $startdir (@INC) {
find(\&wanted, $startdir);
}

sub wanted {
if (-d && /^[a-z]/) {
# this is so we don't go down site_perl etc too early
$File::Find::prune = 1;
return;
}
return unless /\.pm$/;
local $_ = $File::Find::name;
($tmpname = $_) =~ s{^\Q$startdir/}{};
return unless $tmpname =~ /$pattern/o;

if ($opt_l) {
s{^(\Q$startdir\E)/}{$1 } if $opt_s;
}
else {
s{^\Q$startdir/}{};
s/\.pm$//;
s{/}{::}g;
print "$startdir " if $opt_s;
}

print $_, "\n";
}

[/quote]或者你有网络的话[quote] perl -MCPAN -e 'for $mod (CPAN::Shell->expand("Module","/./")){print $mod->id."\n" if $mod->inst_file }'[/quote]