case $CONFIG in '') if test -f config.sh; then TOP=.; elif test -f ../config.sh; then TOP=..; elif test -f ../../config.sh; then TOP=../..; elif test -f ../../../config.sh; then TOP=../../..; elif test -f ../../../../config.sh; then TOP=../../../..; else echo "Can't find config.sh."; exit 1 fi . $TOP/config.sh ;; esac : This forces SH files to create target in same directory as SH file. : This is so that make depend always knows where to find SH derivatives. case "$0" in */*) cd `expr X$0 : 'X\(.*\)/'` ;; esac echo "Extracting perldoc (with variable substitutions)" $spitshell >perldoc <>perldoc <<'!NO!SUBS!' # # Perldoc revision #1 -- look up a piece of documentation in .pod format that # is embedded in the perl installation tree. # # This is not to be confused with Tom Christianson's perlman, which is a # man replacement, written in perl. This perldoc is strictly for reading # the perl manuals, though it too is written in perl. # # Version 1.01: Tue May 30 14:47:34 EDT 1995 # Andy Dougherty # -added pod documentation. # -added PATH searching. # -added searching pod/ subdirectory (mainly to pick up perlfunc.pod # and friends. =head1 NAME perldoc - Look up Perl documentation in pod format. =head1 SYNOPSIS B [B<-h>] PageName|ModuleName =head1 DESCRIPTION I looks up a piece of documentation in .pod format that is embedded in the perl installation tree or in a perl script, and displays it via pod2man | nroff -man | $PAGER. This is primarily used for the documentation for the perl library modules. Your system may also have man pages installed for those modules, in which case you can probably just use the man(1) command. =head1 OPTIONS =over 5 =item B<-h> help Prints out a brief help message. =item B The item you want to look up. Nested modules (such as C) are specified either as C or C. You may also give a descriptive name of a page, such as C. =back =head1 ENVIRONMENT Any switches in the C environment variable will be used before the command line arguments. C also searches directories specified by the C (or C if C is not defined) and C environment variables. (The latter is so that embedded pods for executables, such as C itself, are available.) =head1 AUTHOR Kenneth Albanowski Minor updates by Andy Dougherty =head1 SEE ALSO =head1 DIAGNOSTICS =cut if(@ARGV<1) { die < to get aquainted with the system. EOF } use Getopt::Std; sub usage{ warn "@_\n" if @_; die <) { if(/^=head/) { close(TEST); return 1; } } close(TEST); return 0; } sub searchfor { my($s,@dirs) = @_; $s =~ s!::!/!g; # printf STDERR "looking for $s in @dirs\n"; foreach $dir (@dirs) { if( -f "$dir/$s.pod") { return "$dir/$s.pod" } elsif( -f "$dir/$s.pm" and containspod("$dir/$s.pm")) { return "$dir/$s.pm" } elsif( -f "$dir/$s" and containspod("$dir/$s")) { return "$dir/$s" } elsif( -f "$dir/pod/$s.pod") { return "$dir/pod/$s.pod" } elsif( -f "$dir/pod/$s" and containspod("$dir/pod/$s")) { return "$dir/pod/$s" } } return (); } $ENV{PAGER} ||= "more"; foreach (@pages) { print STDERR "Searching for $_\n"; # We must look both in @INC for library modules and in PATH # for executables, like h2xs or perldoc itself. @searchdirs = @INC; push(@searchdirs, split(':', $ENV{'PATH'}) ); @files= searchfor($_,@searchdirs); if( @files ) { print STDERR "Found as @files\n"; } else { print STDERR "No documentation found for $_\n"; } push(@found,@files); } $cmd=$filter=""; if( ! -t STDOUT ) { $opt_f = 1 } $cmd = "pod2man - | nroff -man"; if( ! $opt_f ) { $filter = "|$ENV{PAGER}" }; open(OUT,"|$cmd$filter"); foreach (@found) { open(IN,"<$_"); print OUT while ; close(IN); } close(OUT); !NO!SUBS! chmod 755 perldoc $eunicefix perldoc