diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-06-18 14:42:07 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-22 16:53:50 +0200 |
commit | 5ec06e76dc20e3154110c2955f25db63f00c527d (patch) | |
tree | 1a8487933aa9373cfaf2e1dcc579621e672de653 /dist | |
parent | d220eb00ef3acc7b8eb92c164c58ff946a556955 (diff) | |
download | perl-5ec06e76dc20e3154110c2955f25db63f00c527d.tar.gz |
In Cwd::_win32_cwd() avoid a string eval when checking if we're miniperl.
To allow ExtUtils::MakeMaker to run tests as if it's "miniperl" we need to avoid
taking any sort of reference to the typeglob or the code in the optree, as its
test modules are loaded later than Cwd. Previously this was done with a string
eval, but that was causing problems (for unclear reasons - rt.cpan.org #56225).
Using a symbol table lookup and *foo{THING} syntax avoids the string eval.
Evolved from a suggestion by Reini Urban.
Diffstat (limited to 'dist')
-rw-r--r-- | dist/Cwd/Cwd.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/dist/Cwd/Cwd.pm b/dist/Cwd/Cwd.pm index 4683e103b8..ecd14aedf4 100644 --- a/dist/Cwd/Cwd.pm +++ b/dist/Cwd/Cwd.pm @@ -171,7 +171,7 @@ use strict; use Exporter; use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); -$VERSION = '3.36'; +$VERSION = '3.37'; my $xs_version = $VERSION; $VERSION = eval $VERSION; @@ -755,7 +755,14 @@ sub _win32_cwd_simple { } sub _win32_cwd { - if (eval 'defined &DynaLoader::boot_DynaLoader') { + # Need to avoid taking any sort of reference to the typeglob or the code in + # the optree, so that this tests the runtime state of things, as the + # ExtUtils::MakeMaker tests for "miniperl" need to be able to fake things at + # runtime by deleting the subroutine. *foo{THING} syntax on a symbol table + # lookup avoids needing a string eval, which has been reported to cause + # problems (for reasons that we haven't been able to get to the bottom of - + # rt.cpan.org #56225) + if (*{$DynaLoader::{boot_DynaLoader}}{CODE}) { $ENV{'PWD'} = Win32::GetCwd(); } else { # miniperl |