X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCwd.pm;h=15525dab4215195bd5b5255a1ba74ac3fa8e56ab;hb=c74ace89800a81a764294e9f6eacc04bbed5a568;hp=c389c385d69bfecdf8d49a1e27a0b1439072b636;hpb=8e6a5f51ce130bc855c9ce739a2ac67752f39617;p=p5sagit%2Fp5-mst-13.2.git diff --git a/lib/Cwd.pm b/lib/Cwd.pm index c389c38..15525da 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -170,7 +170,7 @@ use strict; use Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); -$VERSION = '3.04_01'; +$VERSION = '3.07'; @ISA = qw/ Exporter /; @EXPORT = qw(cwd getcwd fastcwd fastgetcwd); @@ -199,15 +199,16 @@ if ($^O eq 'os2') { return 1; } +# If loading the XS stuff doesn't work, we can fall back to pure perl eval { -if ( $] >= 5.006 ) { - require XSLoader; - XSLoader::load( __PACKAGE__, $VERSION ); -} else { - require DynaLoader; - push @ISA, 'DynaLoader'; - __PACKAGE__->bootstrap( $VERSION ); -} + if ( $] >= 5.006 ) { + require XSLoader; + XSLoader::load( __PACKAGE__, $VERSION ); + } else { + require DynaLoader; + push @ISA, 'DynaLoader'; + __PACKAGE__->bootstrap( $VERSION ); + } }; # Must be after the DynaLoader stuff: @@ -329,8 +330,9 @@ sub _backtick_pwd { unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) { # The pwd command is not available in some chroot(2)'ed environments my $sep = $Config::Config{path_sep} || ':'; - if( $^O eq 'MacOS' || (defined $ENV{PATH} && - $^O ne 'MSWin32' && # no pwd on Windows + my $os = $^O; # Protect $^O from tainting + if( $os eq 'MacOS' || (defined $ENV{PATH} && + $os ne 'MSWin32' && # no pwd on Windows grep { -x "$_/pwd" } split($sep, $ENV{PATH})) ) { *cwd = \&_backtick_pwd;