summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-03-04 02:12:13 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-03-04 02:12:13 +0000
commit89b8affaa500ec6c1699f1c161be0e130b1eb79f (patch)
tree724865cc1761f1fab6f648a5f8883a7dd5ad90bc /utils
parent2bb40b7f9f696f78f932ef8d368a2b2dea2c0bbb (diff)
downloadperl-89b8affaa500ec6c1699f1c161be0e130b1eb79f.tar.gz
[win32] maintpatches #102 and #103 to perldoc.PL
p4raw-id: //depot/win32/perl@726
Diffstat (limited to 'utils')
-rw-r--r--utils/perldoc.PL40
1 files changed, 33 insertions, 7 deletions
diff --git a/utils/perldoc.PL b/utils/perldoc.PL
index 76385e2c18..53219a7a94 100644
--- a/utils/perldoc.PL
+++ b/utils/perldoc.PL
@@ -48,11 +48,11 @@ if(@ARGV<1) {
$me = $0; # Editing $0 is unportable
$me =~ s,.*/,,;
die <<EOF;
-Usage: $me [-h] [-v] [-t] [-u] [-m] [-l] [-F] PageName|ModuleName|ProgramName
+Usage: $me [-h] [-v] [-t] [-u] [-m] [-l] [-F] [-X] PageName|ModuleName|ProgramName
$me -f PerlFunc
-We suggest you use "perldoc perldoc" to get aquainted
-with the system.
+The -h option prints more help. Also try "perldoc perldoc" to get
+aquainted with the system.
EOF
}
@@ -83,6 +83,7 @@ Options:
-l Display the modules file name
-F Arguments are file names, not modules
-v Verbosely describe what's going on
+ -X use index if present (looks for pod.idx at $Config{archlib})
PageName|ModuleName...
is the name of a piece of documentation that you want to look at. You
@@ -96,7 +97,8 @@ BuiltinFunction
`perlfunc'.
Any switches in the PERLDOC environment variable will be used before the
-command line arguments.
+command line arguments. The optional pod index file contains a list of
+filenames, one per line.
EOF
}
@@ -106,10 +108,13 @@ use Text::ParseWords;
unshift(@ARGV,shellwords($ENV{"PERLDOC"}));
-getopts("mhtluvFf:") || usage;
+getopts("mhtluvFf:X") || usage;
usage if $opt_h || $opt_h; # avoid -w warning
+$podidx = "$Config{'archlib'}/pod.idx";
+$podidx = "" if $opt_X || !-f "pod.idx" && !-r _ && -M _ > 7;
+
if ($opt_t + $opt_u + $opt_m + $opt_l > 1) {
usage("only one of -t, -u, -m or -l")
} elsif ($Is_MSWin32 || $Is_Dos) {
@@ -252,6 +257,18 @@ sub searchfor {
foreach (@pages) {
+ if ($podidx && open(PODIDX, $podidx)) {
+ my $searchfor = $_;
+ local($_);
+ $searchfor =~ s,::,/,g;
+ print STDERR "Searching for '$searchfor' in $podidx\n" if $opt_v;
+ while (<PODIDX>) {
+ chomp;
+ push(@found, $_) if m,/$searchfor(?:\.(?:pod|pm))?$,i;
+ }
+ close(PODIDX);
+ next;
+ }
print STDERR "Searching for $_\n" if $opt_v;
# We must look both in @INC for library modules and in PATH
# for executables, like h2xs or perldoc itself.
@@ -437,7 +454,7 @@ perldoc - Look up Perl documentation in pod format.
=head1 SYNOPSIS
-B<perldoc> [B<-h>] [B<-v>] [B<-t>] [B<-u>] [B<-m>] [B<-l>] PageName|ModuleName|ProgramName
+B<perldoc> [B<-h>] [B<-v>] [B<-t>] [B<-u>] [B<-m>] [B<-l>] [B<-F>] [B<-X>] PageName|ModuleName|ProgramName
B<perldoc> B<-f> BuiltinFunction
@@ -486,13 +503,19 @@ Display the file name of the module found.
=item B<-F> file names
-Consider arguments as file names, no search in directories should be performed.
+Consider arguments as file names, no search in directories will be performed.
=item B<-f> perlfunc
The B<-f> option followed by the name of a perl built in function will
extract the documentation of this function from L<perlfunc>.
+=item B<-X> use an index if present
+
+The B<-X> option looks for a entry whose basename matches the name given on the
+command line in the file C<$Config{archlib}/pod.idx>. The pod.idx file should
+contain fully qualified filenames, one per line.
+
=item B<PageName|ModuleName|ProgramName>
The item you want to look up. Nested modules (such as C<File::Basename>)
@@ -522,6 +545,9 @@ Minor updates by Andy Dougherty <doughera@lafcol.lafayette.edu>
=cut
#
+# Version 1.13: Fri Feb 27 16:20:50 EST 1997
+# Gurusamy Sarathy <gsar@umich.edu>
+# -doc tweaks for -F and -X options
# Version 1.12: Sat Apr 12 22:41:09 EST 1997
# Gurusamy Sarathy <gsar@umich.edu>
# -various fixes for win32