Mailing List Archive

something to make index podidx for perlmod
$ cd perl5.002beta
$ perl mkmodidx ext lib > modidx
$ grep '^[a-z]' < modidx | sort > prag.idx
$ grep -v '^[a-z]' < modidx | sort > std.idx

#!/usr/bin/perl
# mkmodidx - tchrist@perl.com
require 'find.pl';
@ARGV = ('.') unless @ARGV;
$/ = '';
$strip = join ( '|', map { quotemeta($_) } @ARGV );
find(@ARGV);
sub wanted {
return unless /[a-z].*\.pm$/i;
unless ( open(F, $_) ) { warn "$name: $!"; next; }
($module = $name) =~ s/\.pm$//;
$module =~ s!^($strip)/!!o;
$module =~ s!/!::!g;
($tail) = $module =~ /(\w+)$/;
my $found = 0;
while (<F>) {
if ( /^=head1\s+NAME\b/ ) {
$found++;
$_ = <F>;
chomp;
s/^(?!$tail)(\w+)\s+/${module}::$1 /gm;
print "$_\n";
last;
}
}
unless ($found) { print STDERR "$0: No docs found in $name\n" }
}