From: Ilya Zakharevich Date: Mon, 16 Jun 1997 00:18:02 +0000 (+1200) Subject: perldoc under OS/2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=59586d7795db81c5ffcd935ba8614353199c2a71;p=p5sagit%2Fp5-mst-13.2.git perldoc under OS/2 We split path on $Config{path_sep} instead of '/' (Yes!), check for .cmd and .bat files if needed, and use POSIX::tmpnam to get a tmp file (last only on OS/2 for extra safety). Enjoy, p5p-msgid: 199707180340.XAA03114@monk.mps.ohio-state.edu --- diff --git a/utils/perldoc.PL b/utils/perldoc.PL index 999496b..a17cca9 100644 --- a/utils/perldoc.PL +++ b/utils/perldoc.PL @@ -56,6 +56,8 @@ EOF } use Getopt::Std; +use Config '%Config'; + $Is_VMS = $^O eq 'VMS'; $Is_MSWin32 = $^O eq 'MSWin32'; @@ -188,7 +190,9 @@ sub containspod { or ( $ret = minus_f_nocase "$dir/$s" and containspod($ret)) or ( $Is_VMS and $ret = minus_f_nocase "$dir/$s.com" and containspod($ret)) - or ( $Is_MSWin32 and + or ( $^O eq 'os2' and + $ret = minus_f_nocase "$dir/$s.cmd" and containspod($ret)) + or ( ($Is_MSWin32 or $^O eq 'os2') and $ret = minus_f_nocase "$dir/$s.bat" and containspod($ret)) or ( $ret = minus_f_nocase "$dir/pod/$s.pod") or ( $ret = minus_f_nocase "$dir/pod/$s" and containspod($ret))) @@ -219,10 +223,9 @@ foreach (@pages) { for ($i = 0; $trn = $ENV{'DCL$PATH'.$i}; $i++) { push(@searchdirs,$trn); } - } elsif ($Is_MSWin32) { - push(@searchdirs, grep(-d, split(';', $ENV{'PATH'}))); } else { - push(@searchdirs, grep(-d, split(':', $ENV{'PATH'}))); + push(@searchdirs, grep(-d, split($Config{path_sep}, + $ENV{'PATH'}))); } @files= searchfor(0,$_,@searchdirs); } @@ -263,7 +266,12 @@ if ($Is_MSWin32) { $tmp = 'Sys$Scratch:perldoc.tmp1_'.$$; push @pagers, qw( most more less type/page ); } else { - $tmp = "/tmp/perldoc1.$$"; + if ($^O eq 'os2') { + require POSIX; + $tmp = POSIX::tmpnam(); + } else { + $tmp = "/tmp/perldoc1.$$"; + } push @pagers, qw( more less pg view cat ); unshift @pagers, $ENV{PAGER} if $ENV{PAGER}; }