my \@pagers = ();
push \@pagers, "$Config{'pager'}" if -x "$Config{'pager'}";
+my \$bindir = "$Config{installscript}";
!GROK!THIS!
use Fcntl; # for sysopen
use Getopt::Std;
use Config '%Config';
+use File::Spec::Functions qw(catfile splitdir);
#
# Perldoc revision #1 -- look up a piece of documentation in .pod format that
sub minus_f_nocase {
my($dir,$file) = @_;
- my $path = join('/',$dir,$file); # XXX: dirseps
+ my $path = catfile($dir,$file);
return $path if -f $path and -r _;
if (!$opt_i or $Is_VMS or $Is_MSWin32 or $Is_Dos or $^O eq 'os2') {
# on a case-forgiving file system or if case is important
local($")="/";
my @p = ($dir);
my($p,$cip);
- foreach $p (split(m!/!, $file)){ # XXX: dirseps
- my $try = "@p/$p";
+ foreach $p (splitdir $file){
+ my $try = catfile @p, $p;
stat $try;
if (-d _) {
push @p, $p;
if ( $p eq $global_target) {
- my $tmp_path = join ('/', @p); # XXX: dirseps
+ my $tmp_path = catfile @p;
my $path_f = 0;
for (@global_found) {
$path_f = 1 if $_ eq $tmp_path;
my $ret;
my $i;
my $dir;
- $global_target = (split(m!/!, $s))[-1]; # XXX: dirseps
+ $global_target = (splitdir $s)[-1]; # XXX: why not use File::Basename?
for ($i=0; $i<@dirs; $i++) {
$dir = $dirs[$i];
($dir = VMS::Filespec::unixpath($dir)) =~ s!/\z!! if $Is_VMS;
if ($recurse) {
opendir(D,$dir) or die "Can't opendir $dir: $!";
- my @newdirs = map "$dir/$_", grep { # XXX: dirseps
+ my @newdirs = map catfile($dir, $_), grep {
not /^\.\.?\z/s and
not /^auto\z/s and # save time! don't search auto dirs
- -d "$dir/$_" # XXX: dirseps
+ -d catfile($dir, $_)
} readdir D;
closedir(D) or die "Can't closedir $dir: $!";
next unless @newdirs;
close OUT or die "can't close $tmp: $!";
}
elsif (not $opt_u) {
- my $cmd = "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;
my @found;
foreach (@pages) {
if ($podidx && open(PODIDX, $podidx)) {
- my $searchfor = $_;
- $searchfor =~ s,::,/,g; # XXX: dirseps
+ my $searchfor = catfile split '::';
print STDERR "Searching for '$searchfor' in $podidx\n" if $opt_v;
local $_;
while (<PODIDX>) {