Bob viewing online, there is nothing better than Activestate's
html perldocs (to think otherwise means you're a kook
).
But since the world needs kooks, and since it takes no effort to
repeat the worked examples of Randal Schwartz, pasted below is a
a script that generates an index for all the Perl functions, and
below that again is a script for using Emacs as a pager to access
the pod information on those functions.
%<------------------------------%<-----------------------------------
#!perl
# ex 16_1 llama book 3ed
# Reads through the perlfunc.pod file looking for identifier
# names on =item lines. Then writes to a database showing the
# first line number on which each identifier appears.
# useage: perl ex16_1.plx
use strict; use warnings;
chomp(my $path_to_perlfunc = `perldoc.bat -l perlfunc`);
open my $pf, $path_to_perlfunc or die "Can't open perlfunc.pod: $!";
dbmopen my %DB, "pf_data", 0644 or die "Can't create dbm file: $!";
%DB = (); # wipe out the entire database
while (<$pf>) {
if (/^=item\s+([a-z_]\w*)/i) {
$DB{$1} = $DB{$1} || $.;
}
}
print "Done!\n";
%<------------------------------%<-----------------------------------
%<------------------------------%<-----------------------------------
#!perl
# ex 16_3 llama book 3ed
# Takes a Perl function name on the command line, and launches
# the pager gnuclient to view the perlfunc.pod file at the line
# that first mentions that function.
# useage: perl ex16_3.plx atan2
use strict; use warnings;
chomp(my $path_to_perlfunc = `perldoc.bat -l perlfunc`);
dbmopen my %DB, "pf_data", undef or die "Can't open dbm file: $!";
if ( my $line = $DB{ $ARGV[0] } ) {
exec 'gnuclientw', "+$line", $path_to_perlfunc
or die "Can't exec pager: $!";
} else {
die "Entry unknown: '$ARGV[0]'.\n";
}
%<------------------------------%<-----------------------------------