【perl】 モジュール一覧
どんなモジュールが入っているかを一覧にしてみた。
ググってみたら、そのものズバリな答えがあったので、
ブラウザでちゃんと改行して表示されるようになおしてみた。
中身はこう。
#! /usr/bin/perl
use strict;
my %mod_list;
print "Content-type: text/html;\n\n";
print "<html><body>";
listup($_) for grep {$_ ne '.'} @INC;
print "$_\<br\>\n" for sort keys %mod_list;
sub listup {
my ($base, $path) = @_;
(my $mod = $path) =~ s!/!::!g;
opendir DIR, "$base/$path" or return;
my @node = grep {!/^\.\.?$/} readdir DIR;
closedir DIR;
foreach (@node) {
if (/(.+)\.pm$/) { $mod_list{"$mod$1"} = 1 }
elsif (-d "$base/$path$_") { listup($base, "$path$_/") }
}
}
print "</body></html>";
ググってみたら、そのものズバリな答えがあったので、
ブラウザでちゃんと改行して表示されるようになおしてみた。
中身はこう。
#! /usr/bin/perl
use strict;
my %mod_list;
print "Content-type: text/html;\n\n";
print "<html><body>";
listup($_) for grep {$_ ne '.'} @INC;
print "$_\<br\>\n" for sort keys %mod_list;
sub listup {
my ($base, $path) = @_;
(my $mod = $path) =~ s!/!::!g;
opendir DIR, "$base/$path" or return;
my @node = grep {!/^\.\.?$/} readdir DIR;
closedir DIR;
foreach (@node) {
if (/(.+)\.pm$/) { $mod_list{"$mod$1"} = 1 }
elsif (-d "$base/$path$_") { listup($base, "$path$_/") }
}
}
print "</body></html>";
トラックバック(0)
このブログ記事を参照しているブログ一覧: 【perl】 モジュール一覧
このブログ記事に対するトラックバックURL: http://www.blogcube.info/cgi-bin/mt-tb.cgi/37

これ、ちゃんと動く?