Upgrade to Test::Harness 2.30.
[p5sagit/p5-mst-13.2.git] / lib / Cwd.pm
index 24ad1e2..baeb05c 100644 (file)
@@ -150,7 +150,7 @@ use strict;
 
 use Carp;
 
-our $VERSION = '2.06';
+our $VERSION = '2.07';
 
 use base qw/ Exporter /;
 our @EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
@@ -192,15 +192,20 @@ foreach my $try (qw(/bin/pwd /usr/bin/pwd)) {
         last;
     }
 }
-$pwd_cmd ||= 'pwd';
+unless ($pwd_cmd) {
+    if (-x '/QOpenSys/bin/pwd') { # OS/400 PASE.
+        $pwd_cmd = '/QOpenSys/bin/pwd' ;
+    } else {
+        # Isn't this wrong?  _backtick_pwd() will fail if somenone has
+        # pwd in their path but it is not /bin/pwd or /usr/bin/pwd?
+        # See [perl #16774]. --jhi
+        $pwd_cmd = 'pwd';
+    }
+}
 
 # The 'natural and safe form' for UNIX (pwd may be setuid root)
 sub _backtick_pwd {
-    local $ENV{PATH};
-    local $ENV{IFS};
-    local $ENV{CDPATH};
-    local $ENV{ENV};
-    local $ENV{BASH_ENV};
+    local @ENV{qw(PATH IFS CDPATH ENV BASH_ENV)};
     my $cwd = `$pwd_cmd`;
     # Belt-and-suspenders in case someone said "undef $/".
     local $/ = "\n";
@@ -374,6 +379,7 @@ sub _perl_abs_path
     {
        $dotdots .= '/..';
        @pst = @cst;
+       local *PARENT;
        unless (opendir(PARENT, $dotdots))
        {
            carp "opendir($dotdots): $!";