From: Michael G. Schwern Date: Sun, 13 Jan 2002 21:00:07 +0000 (-0500) Subject: Re: [ID 20020113.006] Cwd.pm uses uninitialized $ENV{PATH} X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73b801a60cb6aa35dadd081292289a75e703112e;p=p5sagit%2Fp5-mst-13.2.git Re: [ID 20020113.006] Cwd.pm uses uninitialized $ENV{PATH} Message-Id: <20020114020007.GB2877@blackrider> p4raw-id: //depot/perl@14253 --- diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 63a14fd..0db9410 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -200,7 +200,9 @@ sub _backtick_pwd { unless(defined &cwd) { # The pwd command is not available in some chroot(2)'ed environments - if($^O eq 'MacOS' || grep { -x "$_/pwd" } split(':', $ENV{PATH})) { + if( $^O eq 'MacOS' || (defined $ENV{PATH} && + grep { -x "$_/pwd" } split(':', $ENV{PATH})) ) + { *cwd = \&_backtick_pwd; } else {