home *** CD-ROM | disk | FTP | other *** search
/ Chip: Windows 2000 Professional Resource Kit / W2KPRK.iso / apps / perl / ActivePerl.exe / data.z / perldoc.bat < prev    next >
Encoding:
DOS Batch File  |  1999-10-16  |  18.8 KB  |  720 lines

  1. @rem = '--*-Perl-*--
  2. @echo off
  3. if "%OS%" == "Windows_NT" goto WinNT
  4. perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
  5. goto endofperl
  6. :WinNT
  7. perl -x -S "%0" %*
  8. if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
  9. if %errorlevel% == 9009 echo You do not have Perl in your PATH.
  10. goto endofperl
  11. @rem ';
  12. #!perl
  13. #line 14
  14.     eval 'exec P:\Apps\ActivePerl\temp\bin\MSWin32-x86-object\perl.exe -S $0 ${1+"$@"}'
  15.     if 0;
  16.  
  17. use strict;
  18. my @pagers = ();
  19. push @pagers, "more /e" if -x "more /e";
  20.  
  21. #
  22. # Perldoc revision #1 -- look up a piece of documentation in .pod format that
  23. # is embedded in the perl installation tree.
  24. #
  25. # This is not to be confused with Tom Christianson's perlman, which is a
  26. # man replacement, written in perl. This perldoc is strictly for reading
  27. # the perl manuals, though it too is written in perl.
  28.  
  29. if (@ARGV<1) {
  30.     my $me = $0;        # Editing $0 is unportable
  31.     $me =~ s,.*/,,;
  32.     die <<EOF;
  33. Usage: $me [-h] [-r] [-i] [-v] [-t] [-u] [-m] [-l] [-F] [-X] PageName|ModuleName|ProgramName
  34.        $me -f PerlFunc
  35.        $me -q FAQKeywords
  36.  
  37. The -h option prints more help.  Also try "perldoc perldoc" to get
  38. aquainted with the system.
  39. EOF
  40. }
  41.  
  42. use Getopt::Std;
  43. use Config '%Config';
  44.  
  45. my @global_found = ();
  46. my $global_target = "";
  47.  
  48. my $Is_VMS = $^O eq 'VMS';
  49. my $Is_MSWin32 = $^O eq 'MSWin32';
  50. my $Is_Dos = $^O eq 'dos';
  51.  
  52. sub usage{
  53.     warn "@_\n" if @_;
  54.     # Erase evidence of previous errors (if any), so exit status is simple.
  55.     $! = 0;
  56.     die <<EOF;
  57. perldoc [options] PageName|ModuleName|ProgramName...
  58. perldoc [options] -f BuiltinFunction
  59. perldoc [options] -q FAQRegex
  60.  
  61. Options:
  62.     -h   Display this help message
  63.     -r   Recursive search (slow)
  64.     -i   Ignore case
  65.     -t   Display pod using pod2text instead of pod2man and nroff
  66.              (-t is the default on win32)
  67.     -u     Display unformatted pod text
  68.     -m   Display module's file in its entirety
  69.     -l   Display the module's file name
  70.     -F   Arguments are file names, not modules
  71.     -v     Verbosely describe what's going on
  72.     -X     use index if present (looks for pod.idx at $Config{archlib})
  73.     -q   Search the text of questions (not answers) in perlfaq[1-9]
  74.  
  75. PageName|ModuleName...
  76.          is the name of a piece of documentation that you want to look at. You
  77.          may either give a descriptive name of the page (as in the case of
  78.          `perlfunc') the name of a module, either like `Term::Info',
  79.          `Term/Info', the partial name of a module, like `info', or
  80.          `makemaker', or the name of a program, like `perldoc'.
  81.  
  82. BuiltinFunction
  83.          is the name of a perl function.  Will extract documentation from
  84.          `perlfunc'.
  85.  
  86. FAQRegex
  87.          is a regex. Will search perlfaq[1-9] for and extract any
  88.          questions that match.
  89.  
  90. Any switches in the PERLDOC environment variable will be used before the
  91. command line arguments.  The optional pod index file contains a list of
  92. filenames, one per line.
  93.  
  94. EOF
  95. }
  96.  
  97. if (defined $ENV{"PERLDOC"}) {
  98.     require Text::ParseWords;
  99.     unshift(@ARGV, Text::ParseWords::shellwords($ENV{"PERLDOC"}));
  100. }
  101.  
  102. use vars qw( $opt_m $opt_h $opt_t $opt_l $opt_u $opt_v $opt_r $opt_i $opt_F $opt_f $opt_X $opt_q );
  103.  
  104. getopts("mhtluvriFf:Xq:") || usage;
  105.  
  106. usage if $opt_h;
  107.  
  108. my $podidx;
  109. if ($opt_X) {
  110.     $podidx = "$Config{'archlib'}/pod.idx";
  111.     $podidx = "" unless -f $podidx && -r _ && -M _ <= 7;
  112. }
  113.  
  114. if ((my $opts = do{ local $^W; $opt_t + $opt_u + $opt_m + $opt_l }) > 1) {
  115.     usage("only one of -t, -u, -m or -l")
  116. }
  117. elsif ($Is_MSWin32
  118.        || $Is_Dos
  119.        || !(exists $ENV{TERM} && $ENV{TERM} !~ /dumb|emacs|none|unknown/i))
  120. {
  121.     $opt_t = 1 unless $opts
  122. }
  123.  
  124. if ($opt_t) { require Pod::Text; import Pod::Text; }
  125.  
  126. my @pages;
  127. if ($opt_f) {
  128.     @pages = ("perlfunc");
  129. }
  130. elsif ($opt_q) {
  131.     @pages = ("perlfaq1" .. "perlfaq9");
  132. }
  133. else {
  134.     @pages = @ARGV;
  135. }
  136.  
  137. # Does this look like a module or extension directory?
  138. if (-f "Makefile.PL") {
  139.     # Add ., lib and blib/* libs to @INC (if they exist)
  140.     unshift(@INC, '.');
  141.     unshift(@INC, 'lib') if -d 'lib';
  142.     require ExtUtils::testlib;
  143. }
  144.  
  145. sub containspod {
  146.     my($file, $readit) = @_;
  147.     return 1 if !$readit && $file =~ /\.pod$/i;
  148.     local($_);
  149.     open(TEST,"<$file");
  150.     while (<TEST>) {
  151.     if (/^=head/) {
  152.         close(TEST);
  153.         return 1;
  154.     }
  155.     }
  156.     close(TEST);
  157.     return 0;
  158. }
  159.  
  160. sub minus_f_nocase {
  161.      my($dir,$file) = @_;
  162.      my $path = join('/',$dir,$file);
  163.      return $path if -f $path and -r _;
  164.      if (!$opt_i or $Is_VMS or $Is_MSWin32 or $Is_Dos or $^O eq 'os2') {
  165.         # on a case-forgiving file system or if case is important
  166.     # that is it all we can do
  167.     warn "Ignored $path: unreadable\n" if -f _;
  168.     return '';
  169.      }
  170.      local *DIR;
  171.      local($")="/";
  172.      my @p = ($dir);
  173.      my($p,$cip);
  174.      foreach $p (split(/\//, $file)){
  175.     my $try = "@p/$p";
  176.     stat $try;
  177.      if (-d _) {
  178.          push @p, $p;
  179.         if ( $p eq $global_target) {
  180.         my $tmp_path = join ('/', @p);
  181.         my $path_f = 0;
  182.         for (@global_found) {
  183.             $path_f = 1 if $_ eq $tmp_path;
  184.         }
  185.         push (@global_found, $tmp_path) unless $path_f;
  186.         print STDERR "Found as @p but directory\n" if $opt_v;
  187.         }
  188.      }
  189.     elsif (-f _ && -r _) {
  190.          return $try;
  191.      }
  192.     elsif (-f _) {
  193.         warn "Ignored $try: unreadable\n";
  194.      }
  195.     else {
  196.          my $found=0;
  197.          my $lcp = lc $p;
  198.          opendir DIR, "@p";
  199.          while ($cip=readdir(DIR)) {
  200.          if (lc $cip eq $lcp){
  201.              $found++;
  202.              last;
  203.          }
  204.          }
  205.          closedir DIR;
  206.          return "" unless $found;
  207.          push @p, $cip;
  208.          return "@p" if -f "@p" and -r _;
  209.         warn "Ignored @p: unreadable\n" if -f _;
  210.      }
  211.      }
  212.      return "";
  213. }
  214.  
  215.  
  216. sub check_file {
  217.     my($dir,$file) = @_;
  218.     if ($opt_m) {
  219.     return minus_f_nocase($dir,$file);
  220.     }
  221.     else {
  222.     my $path = minus_f_nocase($dir,$file);
  223.         return $path if length $path and containspod($path);
  224.     }
  225.     return "";
  226. }
  227.  
  228.  
  229. sub searchfor {
  230.     my($recurse,$s,@dirs) = @_;
  231.     $s =~ s!::!/!g;
  232.     $s = VMS::Filespec::unixify($s) if $Is_VMS;
  233.     return $s if -f $s && containspod($s);
  234.     printf STDERR "Looking for $s in @dirs\n" if $opt_v;
  235.     my $ret;
  236.     my $i;
  237.     my $dir;
  238.     $global_target = (split('/', $s))[-1];
  239.     for ($i=0; $i<@dirs; $i++) {
  240.     $dir = $dirs[$i];
  241.     ($dir = VMS::Filespec::unixpath($dir)) =~ s!/$!! if $Is_VMS;
  242.     if (       ( $ret = check_file $dir,"$s.pod")
  243.         or ( $ret = check_file $dir,"$s.pm")
  244.         or ( $ret = check_file $dir,$s)
  245.         or ( $Is_VMS and
  246.              $ret = check_file $dir,"$s.com")
  247.         or ( $^O eq 'os2' and
  248.              $ret = check_file $dir,"$s.cmd")
  249.         or ( ($Is_MSWin32 or $Is_Dos or $^O eq 'os2') and
  250.              $ret = check_file $dir,"$s.bat")
  251.         or ( $ret = check_file "$dir/pod","$s.pod")
  252.         or ( $ret = check_file "$dir/pod",$s)
  253.     ) {
  254.         return $ret;
  255.     }
  256.  
  257.     if ($recurse) {
  258.         opendir(D,$dir);
  259.         my @newdirs = map "$dir/$_", grep {
  260.         not /^\.\.?$/ and
  261.         not /^auto$/  and   # save time! don't search auto dirs
  262.         -d  "$dir/$_"
  263.         } readdir D;
  264.         closedir(D);
  265.         next unless @newdirs;
  266.         @newdirs = map((s/.dir$//,$_)[1],@newdirs) if $Is_VMS;
  267.         print STDERR "Also looking in @newdirs\n" if $opt_v;
  268.         push(@dirs,@newdirs);
  269.     }
  270.     }
  271.     return ();
  272. }
  273.  
  274. sub filter_nroff {
  275.   my @data = split /\n{2,}/, shift;
  276.   shift @data while @data and $data[0] !~ /\S/; # Go to header
  277.   shift @data if @data and $data[0] =~ /Contributed\s+Perl/; # Skip header
  278.   pop @data if @data and $data[-1] =~ /^\w/; # Skip footer, like
  279.                 # 28/Jan/99 perl 5.005, patch 53 1
  280.   join "\n\n", @data;
  281. }
  282.  
  283. sub printout {
  284.     my ($file, $tmp, $filter) = @_;
  285.     my $err;
  286.  
  287.     if ($opt_t) {
  288.     open(TMP,">>$tmp")
  289.         or warn("Can't open $tmp: $!"), return;
  290.     Pod::Text::pod2text($file,*TMP);
  291.     close TMP;
  292.     }
  293.     elsif (not $opt_u) {
  294.     my $cmd = "pod2man --lax $file | nroff -man";
  295.     $cmd .= " | col -x" if $^O =~ /hpux/;
  296.     my $rslt = `$cmd`;
  297.     $rslt = filter_nroff($rslt) if $filter;
  298.     unless (($err = $?)) {
  299.         open(TMP,">>$tmp") or warn("Can't open $tmp: $!"), return;
  300.         print TMP $rslt;
  301.         close TMP;
  302.     }
  303.     }
  304.     if ($opt_u or $err or -z $tmp) {
  305.     open(OUT,">>$tmp") or warn("Can't open $tmp: $!"), return;
  306.     open(IN,"<$file") or warn("Can't open $file: $!"), return;
  307.     my $cut = 1;
  308.     while (<IN>) {
  309.         $cut = $1 eq 'cut' if /^=(\w+)/;
  310.         next if $cut;
  311.         print OUT;
  312.     }
  313.     close IN;
  314.     close OUT;
  315.     }
  316. }
  317.  
  318. sub page {
  319.     my ($tmp, $no_tty, @pagers) = @_;
  320.     if ($no_tty) {
  321.     open(TMP,"<$tmp") or warn("Can't open $tmp: $!"), return;
  322.     print while <TMP>;
  323.     close TMP;
  324.     }
  325.     else {
  326.     foreach my $pager (@pagers) {
  327.         system("$pager $tmp") or last;
  328.     }
  329.     }
  330. }
  331.  
  332. sub cleanup {
  333.     my @files = @_;
  334.     for (@files) {
  335.     1 while unlink($_); #Possibly pointless VMSism
  336.     }
  337. }
  338.  
  339. sub safe_exit {
  340.     my ($val, @files) = @_;
  341.     cleanup(@files);
  342.     exit $val;
  343. }
  344.  
  345. sub safe_die {
  346.     my ($msg, @files) = @_;
  347.     cleanup(@files);
  348.     die $msg;
  349. }
  350.  
  351. my @found;
  352. foreach (@pages) {
  353.     if ($podidx && open(PODIDX, $podidx)) {
  354.     my $searchfor = $_;
  355.     local($_);
  356.     $searchfor =~ s,::,/,g;
  357.     print STDERR "Searching for '$searchfor' in $podidx\n" if $opt_v;
  358.     while (<PODIDX>) {
  359.         chomp;
  360.         push(@found, $_) if m,/$searchfor(?:\.(?:pod|pm))?$,i;
  361.     }
  362.     close(PODIDX);
  363.     next;
  364.     }
  365.     print STDERR "Searching for $_\n" if $opt_v;
  366.     # We must look both in @INC for library modules and in PATH
  367.     # for executables, like h2xs or perldoc itself.
  368.     my @searchdirs = @INC;
  369.     if ($opt_F) {
  370.     next unless -r;
  371.     push @found, $_ if $opt_m or containspod($_);
  372.     next;
  373.     }
  374.     unless ($opt_m) {
  375.     if ($Is_VMS) {
  376.         my($i,$trn);
  377.         for ($i = 0; $trn = $ENV{'DCL$PATH;'.$i}; $i++) {
  378.         push(@searchdirs,$trn);
  379.         }
  380.         push(@searchdirs,'perl_root:[lib.pod]')  # installed pods
  381.     }
  382.     else {
  383.         push(@searchdirs, grep(-d, split($Config{path_sep},
  384.                          $ENV{'PATH'})));
  385.     }
  386.     }
  387.     my @files = searchfor(0,$_,@searchdirs);
  388.     if (@files) {
  389.     print STDERR "Found as @files\n" if $opt_v;
  390.     }
  391.     else {
  392.     # no match, try recursive search
  393.     @searchdirs = grep(!/^\.$/,@INC);
  394.     @files= searchfor(1,$_,@searchdirs) if $opt_r;
  395.     if (@files) {
  396.         print STDERR "Loosely found as @files\n" if $opt_v;
  397.     }
  398.     else {
  399.         print STDERR "No documentation found for \"$_\".\n";
  400.         if (@global_found) {
  401.         print STDERR "However, try\n";
  402.         for my $dir (@global_found) {
  403.             opendir(DIR, $dir) or die "$!";
  404.             while (my $file = readdir(DIR)) {
  405.             next if ($file =~ /^\./);
  406.             $file =~ s/\.(pm|pod)$//;
  407.             print STDERR "\tperldoc $_\::$file\n";
  408.             }
  409.             closedir DIR;
  410.         }
  411.         }
  412.     }
  413.     }
  414.     push(@found,@files);
  415. }
  416.  
  417. if (!@found) {
  418.     exit ($Is_VMS ? 98962 : 1);
  419. }
  420.  
  421. if ($opt_l) {
  422.     print join("\n", @found), "\n";
  423.     exit;
  424. }
  425.  
  426. my $lines = $ENV{LINES} || 24;
  427.  
  428. my $no_tty;
  429. if (! -t STDOUT) { $no_tty = 1 }
  430.  
  431. # until here we could simply exit or die
  432. # now we create temporary files that we have to clean up
  433. # namely $tmp, $buffer
  434.  
  435. my $tmp;
  436. my $buffer;
  437. if ($Is_MSWin32) {
  438.     $tmp = "$ENV{TEMP}\\perldoc1.$$";
  439.     $buffer = "$ENV{TEMP}\\perldoc1.b$$";
  440.     push @pagers, qw( more< less notepad );
  441.     unshift @pagers, $ENV{PAGER}  if $ENV{PAGER};
  442.     for (@found) { s,/,\\,g }
  443. }
  444. elsif ($Is_VMS) {
  445.     $tmp = 'Sys$Scratch:perldoc.tmp1_'.$$;
  446.     $buffer = 'Sys$Scratch:perldoc.tmp1_b'.$$;
  447.     push @pagers, qw( most more less type/page );
  448. }
  449. elsif ($Is_Dos) {
  450.     $tmp = "$ENV{TEMP}/perldoc1.$$";
  451.     $buffer = "$ENV{TEMP}/perldoc1.b$$";
  452.     $tmp =~ tr!\\/!//!s;
  453.     $buffer =~ tr!\\/!//!s;
  454.     push @pagers, qw( less.exe more.com< );
  455.     unshift @pagers, $ENV{PAGER}  if $ENV{PAGER};
  456. }
  457. else {
  458.     if ($^O eq 'os2') {
  459.       require POSIX;
  460.       $tmp = POSIX::tmpnam();
  461.       $buffer = POSIX::tmpnam();
  462.       unshift @pagers, 'less', 'cmd /c more <';
  463.     }
  464.     else {
  465.       $tmp = "/tmp/perldoc1.$$";
  466.       $buffer = "/tmp/perldoc1.b$$";
  467.     }
  468.     push @pagers, qw( more less pg view cat );
  469.     unshift @pagers, $ENV{PAGER}  if $ENV{PAGER};
  470. }
  471. unshift @pagers, $ENV{PERLDOC_PAGER} if $ENV{PERLDOC_PAGER};
  472.  
  473. # all exit calls from here on have to be safe_exit calls (see above)
  474. # and all die calls safe_die calls to guarantee removal of files and
  475. # dir as needed
  476.  
  477. if ($opt_m) {
  478.     foreach my $pager (@pagers) {
  479.     system("$pager @found") or safe_exit(0, $tmp, $buffer);
  480.     }
  481.     if ($Is_VMS) { eval 'use vmsish qw(status exit); exit $?' }
  482.     # I don't get the line above. Please patch yourself as needed.
  483.     safe_exit(1, $tmp, $buffer);
  484. }
  485.  
  486. my @pod;
  487. if ($opt_f) {
  488.     my $perlfunc = shift @found;
  489.     open(PFUNC, $perlfunc)
  490.     or safe_die("Can't open $perlfunc: $!", $tmp, $buffer);
  491.  
  492.     # Functions like -r, -e, etc. are listed under `-X'.
  493.     my $search_string = ($opt_f =~ /^-[rwxoRWXOeszfdlpSbctugkTBMAC]$/)
  494.             ? 'I<-X' : $opt_f ;
  495.  
  496.     # Skip introduction
  497.     while (<PFUNC>) {
  498.     last if /^=head2 Alphabetical Listing of Perl Functions/;
  499.     }
  500.  
  501.     # Look for our function
  502.     my $found = 0;
  503.     my $inlist = 0;
  504.     while (<PFUNC>) {
  505.     if (/^=item\s+\Q$search_string\E\b/o)  {
  506.         $found = 1;
  507.     }
  508.     elsif (/^=item/) {
  509.         last if $found > 1 and not $inlist;
  510.     }
  511.     next unless $found;
  512.     if (/^=over/) {
  513.         ++$inlist;
  514.     }
  515.     elsif (/^=back/) {
  516.         --$inlist;
  517.     }
  518.     push @pod, $_;
  519.     ++$found if /^\w/;    # found descriptive text
  520.     }
  521.     if (!@pod) {
  522.     die "No documentation for perl function `$opt_f' found\n";
  523.     }
  524. }
  525.  
  526. if ($opt_q) {
  527.     local @ARGV = @found;    # I'm lazy, sue me.
  528.     my $found = 0;
  529.     my %found_in;
  530.  
  531.     while (<>) {
  532.     if (/^=head2\s+.*(?:$opt_q)/oi) {
  533.         $found = 1;
  534.         push @pod, "=head1 Found in $ARGV\n\n" unless $found_in{$ARGV}++;
  535.     }
  536.     elsif (/^=head2/) {
  537.         $found = 0;
  538.     }
  539.     next unless $found;
  540.     push @pod, $_;
  541.     }
  542.     if (!@pod) {
  543.     safe_die("No documentation for perl FAQ keyword `$opt_q' found\n",
  544.          $tmp, $buffer);
  545.     }
  546. }
  547.  
  548. my $filter;
  549.  
  550. if (@pod) {
  551.     open(TMP,">$buffer") or safe_die("Can't open '$buffer': $!", $tmp, $buffer);
  552.     print TMP "=over 8\n\n";
  553.     print TMP @pod;
  554.     print TMP "=back\n";
  555.     close TMP;
  556.     @found = $buffer;
  557.     $filter = 1;
  558. }
  559.  
  560. foreach (@found) {
  561.     printout($_, $tmp, $filter);
  562. }
  563. page($tmp, $no_tty, @pagers);
  564.  
  565. safe_exit(0, $tmp, $buffer);
  566.  
  567. __END__
  568.  
  569. =head1 NAME
  570.  
  571. perldoc - Look up Perl documentation in pod format.
  572.  
  573. =head1 SYNOPSIS
  574.  
  575. B<perldoc> [B<-h>] [B<-v>] [B<-t>] [B<-u>] [B<-m>] [B<-l>] [B<-F>]  [B<-X>] PageName|ModuleName|ProgramName
  576.  
  577. B<perldoc> B<-f> BuiltinFunction
  578.  
  579. B<perldoc> B<-q> FAQ Keyword
  580.  
  581. =head1 DESCRIPTION
  582.  
  583. I<perldoc> looks up a piece of documentation in .pod format that is embedded
  584. in the perl installation tree or in a perl script, and displays it via
  585. C<pod2man | nroff -man | $PAGER>. (In addition, if running under HP-UX,
  586. C<col -x> will be used.) This is primarily used for the documentation for
  587. the perl library modules.
  588.  
  589. Your system may also have man pages installed for those modules, in
  590. which case you can probably just use the man(1) command.
  591.  
  592. =head1 OPTIONS
  593.  
  594. =over 5
  595.  
  596. =item B<-h> help
  597.  
  598. Prints out a brief help message.
  599.  
  600. =item B<-v> verbose
  601.  
  602. Describes search for the item in detail.
  603.  
  604. =item B<-t> text output
  605.  
  606. Display docs using plain text converter, instead of nroff. This may be faster,
  607. but it won't look as nice.
  608.  
  609. =item B<-u> unformatted
  610.  
  611. Find docs only; skip reformatting by pod2*
  612.  
  613. =item B<-m> module
  614.  
  615. Display the entire module: both code and unformatted pod documentation.
  616. This may be useful if the docs don't explain a function in the detail
  617. you need, and you'd like to inspect the code directly; perldoc will find
  618. the file for you and simply hand it off for display.
  619.  
  620. =item B<-l> file name only
  621.  
  622. Display the file name of the module found.
  623.  
  624. =item B<-F> file names
  625.  
  626. Consider arguments as file names, no search in directories will be performed.
  627.  
  628. =item B<-f> perlfunc
  629.  
  630. The B<-f> option followed by the name of a perl built in function will
  631. extract the documentation of this function from L<perlfunc>.
  632.  
  633. =item B<-q> perlfaq
  634.  
  635. The B<-q> option takes a regular expression as an argument.  It will search
  636. the question headings in perlfaq[1-9] and print the entries matching
  637. the regular expression.
  638.  
  639. =item B<-X> use an index if present
  640.  
  641. The B<-X> option looks for a entry whose basename matches the name given on the
  642. command line in the file C<$Config{archlib}/pod.idx>.  The pod.idx file should
  643. contain fully qualified filenames, one per line.
  644.  
  645. =item B<PageName|ModuleName|ProgramName>
  646.  
  647. The item you want to look up.  Nested modules (such as C<File::Basename>)
  648. are specified either as C<File::Basename> or C<File/Basename>.  You may also
  649. give a descriptive name of a page, such as C<perlfunc>. You may also give a
  650. partial or wrong-case name, such as "basename" for "File::Basename", but
  651. this will be slower, if there is more then one page with the same partial
  652. name, you will only get the first one.
  653.  
  654. =back
  655.  
  656. =head1 ENVIRONMENT
  657.  
  658. Any switches in the C<PERLDOC> environment variable will be used before the
  659. command line arguments.  C<perldoc> also searches directories
  660. specified by the C<PERL5LIB> (or C<PERLLIB> if C<PERL5LIB> is not
  661. defined) and C<PATH> environment variables.
  662. (The latter is so that embedded pods for executables, such as
  663. C<perldoc> itself, are available.)  C<perldoc> will use, in order of
  664. preference, the pager defined in C<PERLDOC_PAGER>, C<MANPAGER>, or
  665. C<PAGER> before trying to find a pager on its own.  (C<MANPAGER> is not
  666. used if C<perldoc> was told to display plain text or unformatted pod.)
  667.  
  668. One useful value for C<PERLDOC_PAGER> is C<less -+C -E>.
  669.  
  670. =head1 VERSION
  671.  
  672. This is perldoc v2.0.
  673.  
  674. =head1 AUTHOR
  675.  
  676. Kenneth Albanowski <kjahds@kjahds.com>
  677.  
  678. Minor updates by Andy Dougherty <doughera@lafcol.lafayette.edu>,
  679. and others.
  680.  
  681. =cut
  682.  
  683. #
  684. # Version 1.14: Wed Jul 15 01:50:20 EST 1998
  685. #       Robin Barker <rmb1@cise.npl.co.uk>
  686. #    -strict, -w cleanups
  687. # Version 1.13: Fri Feb 27 16:20:50 EST 1997
  688. #       Gurusamy Sarathy <gsar@umich.edu>
  689. #    -doc tweaks for -F and -X options
  690. # Version 1.12: Sat Apr 12 22:41:09 EST 1997
  691. #       Gurusamy Sarathy <gsar@umich.edu>
  692. #    -various fixes for win32
  693. # Version 1.11: Tue Dec 26 09:54:33 EST 1995
  694. #       Kenneth Albanowski <kjahds@kjahds.com>
  695. #   -added Charles Bailey's further VMS patches, and -u switch
  696. #   -added -t switch, with pod2text support
  697. #
  698. # Version 1.10: Thu Nov  9 07:23:47 EST 1995
  699. #        Kenneth Albanowski <kjahds@kjahds.com>
  700. #    -added VMS support
  701. #    -added better error recognition (on no found pages, just exit. On
  702. #     missing nroff/pod2man, just display raw pod.)
  703. #    -added recursive/case-insensitive matching (thanks, Andreas). This
  704. #     slows things down a bit, unfortunately. Give a precise name, and
  705. #     it'll run faster.
  706. #
  707. # Version 1.01:    Tue May 30 14:47:34 EDT 1995
  708. #        Andy Dougherty  <doughera@lafcol.lafayette.edu>
  709. #   -added pod documentation.
  710. #   -added PATH searching.
  711. #   -added searching pod/ subdirectory (mainly to pick up perlfunc.pod
  712. #    and friends.
  713. #
  714. #
  715. # TODO:
  716. #
  717. #    Cache directories read during sloppy match
  718. __END__
  719. :endofperl
  720.