3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
14 : This forces SH files to create target in same directory as SH file.
15 : This is so that make depend always knows where to find SH derivatives.
17 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
19 echo "Extracting perldoc (with variable substitutions)"
20 $spitshell >perldoc <<!GROK!THIS!
24 $spitshell >>perldoc <<'!NO!SUBS!'
27 # Perldoc revision #1 -- look up a piece of documentation in .pod format that
28 # is embedded in the perl installation tree.
30 # This is not to be confused with Tom Christianson's perlman, which is a
31 # man replacement, written in perl. This perldoc is strictly for reading
32 # the perl manuals, though it too is written in perl.
34 # Version 1.01: Tue May 30 14:47:34 EDT 1995
35 # Andy Dougherty <doughera@lafcol.lafayette.edu>
36 # -added pod documentation.
37 # -added PATH searching.
38 # -added searching pod/ subdirectory (mainly to pick up perlfunc.pod
43 perldoc - Look up Perl documentation in pod format.
47 B<perldoc> [B<-h>] PageName|ModuleName
51 I<perldoc> looks up a piece of documentation in .pod format that is
52 embedded in the perl installation tree or in a perl script, and displays
53 it via pod2man | nroff -man | $PAGER. This is primarily used for the
54 documentation for the perl library modules.
56 Your system may also have man pages installed for those modules, in
57 which case you can probably just use the man(1) command.
65 Prints out a brief help message.
67 =item B<PageName|ModuleName>
69 The item you want to look up. Nested modules (such as C<File::Basename>)
70 are specified either as C<File::Basename> or C<File/Basename>. You
71 may also give a descriptive name of a page, such as C<perlfunc>.
77 Any switches in the C<PERLDOC> environment variable will be used before the
78 command line arguments. C<perldoc> also searches directories
79 specified by the C<PERL5LIB> (or C<PERLLIB> if C<PERL5LIB> is not
80 defined) and C<PATH> environment variables.
81 (The latter is so that embedded pods for executables, such as
82 C<perldoc> itself, are available.)
86 Kenneth Albanowski <kjahds@kjahds.com>
88 Minor updates by Andy Dougherty <doughera@lafcol.lafayette.edu>
98 Usage: $0 [-h] PageName|ModuleName
100 We suggest you use "perldoc perldoc" to get aquainted
110 perlman [-h] PageName|ModuleName...
111 -h Display this help message.
112 PageName|ModuleName...
113 is the name of a piece of documentation that you want to look at. You
114 may either give a descriptive name of the page (as in the case of
115 `perlfunc') or the name of a module, either like `Term::Info',
118 Any switches in the PERLDOC environment variable will be used before the
119 command line arguments.
124 use Text::ParseWords;
126 unshift(@ARGV,shellwords($ENV{"PERLDOC"}));
128 getopts("h") || usage;
152 # printf STDERR "looking for $s in @dirs\n";
154 foreach $dir (@dirs) {
155 if( -f "$dir/$s.pod") { return "$dir/$s.pod" }
156 elsif( -f "$dir/$s.pm" and containspod("$dir/$s.pm"))
157 { return "$dir/$s.pm" }
158 elsif( -f "$dir/$s" and containspod("$dir/$s"))
160 elsif( -f "$dir/pod/$s.pod") { return "$dir/pod/$s.pod" }
161 elsif( -f "$dir/pod/$s" and containspod("$dir/pod/$s"))
162 { return "$dir/pod/$s" }
168 $ENV{PAGER} ||= "more";
171 print STDERR "Searching for $_\n";
172 # We must look both in @INC for library modules and in PATH
173 # for executables, like h2xs or perldoc itself.
175 push(@searchdirs, split(':', $ENV{'PATH'}) );
176 @files= searchfor($_,@searchdirs);
178 print STDERR "Found as @files\n";
180 print STDERR "No documentation found for $_\n";
187 if( ! -t STDOUT ) { $opt_f = 1 }
189 $cmd = "pod2man - | nroff -man";
190 if( ! $opt_f ) { $filter = "|$ENV{PAGER}" };
192 open(OUT,"|$cmd$filter");
195 print OUT while <IN>;