X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=utils%2Fperldoc.PL;h=76caaabda039351cd55a5649aca766866ca56df8;hb=abc0a0153433fe6596e1ca3a6b5572dc424d0f11;hp=565d03388bd79374a077ae66a23a3bfaadee9df6;hpb=d1be9408a3c14848d30728674452e191ba5fffaa;p=p5sagit%2Fp5-mst-13.2.git diff --git a/utils/perldoc.PL b/utils/perldoc.PL index 565d033..76caaab 100644 --- a/utils/perldoc.PL +++ b/utils/perldoc.PL @@ -25,6 +25,8 @@ print "Extracting $file (with variable substitutions)\n"; # In this section, perl variables will be expanded during extraction. # You can use $Config{...} to use Configure variables. +my $versiononly = $Config{versiononly} ? $Config{version} : ''; + print OUT <<"!GROK!THIS!"; $Config{startperl} eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}' @@ -43,7 +45,11 @@ my \@pagers = (); push \@pagers, \$pager if -x \$pager; (my \$bindir = <<'/../') =~ s/\\s*\\z//; -$Config{scriptdir} +$Config{scriptdirexp} +/../ + +(my \$pod2man = <<'/../') =~ s/\\s*\\z//; +pod2man$versiononly /../ !GROK!THIS! @@ -117,9 +123,8 @@ Options: PageName|ModuleName... is the name of a piece of documentation that you want to look at. You may either give a descriptive name of the page (as in the case of - `perlfunc') the name of a module, either like `Term::Info', - `Term/Info', the partial name of a module, like `info', or - `makemaker', or the name of a program, like `perldoc'. + `perlfunc') the name of a module, either like `Term::Info' or like + `Term/Info', or the name of a program, like `perldoc'. BuiltinFunction is the name of a perl function. Will extract documentation from @@ -163,9 +168,29 @@ if (!($Is_VMS || $Is_MSWin32 || $Is_Dos || $Is_OS2) && ($> == 0 || $< == 0) my $id = eval { getpwnam("nobody") }; $id = eval { getpwnam("nouser") } unless defined $id; $id = -2 unless defined $id; + # + # According to Stevens' APUE and various + # (BSD, Solaris, HP-UX) man pages setting + # the real uid first and effective uid second + # is the way to go if one wants to drop privileges, + # because if one changes into an effective uid of + # non-zero, one cannot change the real uid any more. + # + # Actually, it gets even messier. There is + # a third uid, called the saved uid, and as + # long as that is zero, one can get back to + # uid of zero. Setting the real-effective *twice* + # helps in *most* systems (FreeBSD and Solaris) + # but apparently in HP-UX even this doesn't help: + # the saved uid stays zero (apparently the only way + # in HP-UX to change saved uid is to call setuid() + # when the effective uid is zero). + # eval { - $> = $id; # must do this one first! - $< = $id; + $< = $id; # real uid + $> = $id; # effective uid + $< = $id; # real uid + $> = $id; # effective uid }; last if !$@ && $< && $>; } @@ -316,7 +341,7 @@ sub searchfor { for ($i=0; $i<@dirs; $i++) { $dir = $dirs[$i]; ($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if $Is_VMS; - if ( ( $ret = check_file $dir,"$s.pod") + if ( (! $opt_m && ( $ret = check_file $dir,"$s.pod")) or ( $ret = check_file $dir,"$s.pm") or ( $ret = check_file $dir,$s) or ( $Is_VMS and @@ -432,7 +457,8 @@ foreach (@pages) { print STDERR "Loosely found as @files\n" if $opt_v; } else { - print STDERR "No documentation found for \"$_\".\n"; + print STDERR "No " . + ($opt_m ? "module" : "documentation") . " found for \"$_\".\n"; if (@global_found) { print STDERR "However, try\n"; for my $dir (@global_found) { @@ -562,7 +588,7 @@ EOD $found = 1; push @pod, "=head1 Found in $ARGV\n\n" unless $found_in{$ARGV}++; } - elsif (/^=head2/) { + elsif (/^=head[12]/) { $found = 0; } next unless $found; @@ -597,7 +623,7 @@ foreach (@found) { Pod::Text->new()->parse_from_file($file, $tmpfd); } elsif (not $opt_u) { - my $cmd = catfile($bindir, 'pod2man') . " --lax $file | $opt_n -man"; + my $cmd = catfile($bindir, $pod2man) . " --lax $file | $opt_n -man"; $cmd .= " | col -x" if $^O =~ /hpux/; my $rslt = `$cmd`; $rslt = filter_nroff($rslt) if $filter; @@ -664,6 +690,9 @@ 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. +If you are looking for a table of contents to the Perl library modules +documentation, see the L page. + =head1 OPTIONS =over 5 @@ -730,10 +759,7 @@ run. 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. You may also give a -partial or wrong-case name, such as "basename" for "File::Basename", but -this will be slower, if there is more then one page with the same partial -name, you will only get the first one. +give a descriptive name of a page, such as C. =back