rudimentary support for remote debugging, from aeons ago (somewhat
[p5sagit/p5-mst-13.2.git] / utils / perldoc.PL
index 8c1c696..760a0ce 100644 (file)
@@ -51,7 +51,7 @@ if (@ARGV<1) {
        my $me = $0;            # Editing $0 is unportable
        $me =~ s,.*/,,;
        die <<EOF;
-Usage: $me [-h] [-r] [-i] [-v] [-t] [-u] [-m] [-l] [-F] [-X] PageName|ModuleName|ProgramName
+Usage: $me [-h] [-r] [-i] [-v] [-t] [-u] [-m] [-n program] [-l] [-F] [-X] PageName|ModuleName|ProgramName
        $me -f PerlFunc
        $me -q FAQKeywords
 
@@ -87,6 +87,7 @@ Options:
              (-t is the default on win32)
     -u  Display unformatted pod text
     -m   Display module's file in its entirety
+    -n   Specify replacement for nroff
     -l   Display the module's file name
     -F   Arguments are file names, not modules
     -v  Verbosely describe what's going on
@@ -121,7 +122,7 @@ if (defined $ENV{"PERLDOC"}) {
 }
 !NO!SUBS!
 
-my $getopts = "mhtluvriFf:Xq:";
+my $getopts = "mhtluvriFf:Xq:n:";
 print OUT <<"!GET!OPTS!";
 
 use vars qw( @{[map "\$opt_$_", ($getopts =~ /\w/g)]} );
@@ -132,6 +133,7 @@ getopts("$getopts") || usage;
 print OUT <<'!NO!SUBS!';
 
 usage if $opt_h;
+$opt_n = "nroff" if !$opt_n;
 
 my $podidx;
 if ($opt_X) {
@@ -243,6 +245,7 @@ sub minus_f_nocase {
 
 sub check_file {
     my($dir,$file) = @_;
+    return "" if length $dir and not -d $dir;
     if ($opt_m) {
        return minus_f_nocase($dir,$file);
     }
@@ -278,6 +281,8 @@ sub searchfor {
                     $ret = check_file $dir,"$s.bat")
                or ( $ret = check_file "$dir/pod","$s.pod")
                or ( $ret = check_file "$dir/pod",$s)
+               or ( $ret = check_file "$dir/pods","$s.pod")
+               or ( $ret = check_file "$dir/pods",$s)
        ) {
            return $ret;
        }
@@ -313,13 +318,12 @@ sub printout {
     my $err;
 
     if ($opt_t) {
-       open(TMP,">>$tmp")
-               or warn("Can't open $tmp: $!"), return;
-       Pod::Text::pod2text($file,*TMP);
-       close TMP;
+       open(OUT,">>$tmp") or warn("Can't open $tmp: $!"), return;
+       Pod::Text->new()->parse_from_file($file,\*OUT);
+       close OUT;
     }
     elsif (not $opt_u) {
-       my $cmd = "pod2man --lax $file | nroff -man";
+       my $cmd = "pod2man --lax $_ | $opt_n -man";
        $cmd .= " | col -x" if $^O =~ /hpux/;
        my $rslt = `$cmd`;
        $rslt = filter_nroff($rslt) if $filter;
@@ -709,6 +713,10 @@ and others.
 =cut
 
 #
+# Version 1.15: Tue Aug 24 01:50:20 EST 1999
+#       Charles Wilson <cwilson@ece.gatech.edu>
+#      changed /pod/ directory to /pods/ for cygwin
+#         to support cygwin/win32
 # Version 1.14: Wed Jul 15 01:50:20 EST 1998
 #       Robin Barker <rmb1@cise.npl.co.uk>
 #      -strict, -w cleanups