diff options
author | Zefram <zefram@fysh.org> | 2012-02-03 10:53:00 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2012-02-03 10:53:00 +0000 |
commit | 778a861bb0a8d42e4be677cc40a39d1fac0babe5 (patch) | |
tree | 7a62bfeccdf86e1de06ca50ad1310ab9301a0de9 /dist/Carp | |
parent | 864fd8d30af274c82a36ddaf90ed55c91f64ebc7 (diff) | |
download | perl-778a861bb0a8d42e4be677cc40a39d1fac0babe5.tar.gz |
in Carp, avoid vivifying utf8 stash on Perl 5.6
Carp was breaking swash loading on Perl 5.6. Makes no difference to
blead, where the utf8 stash is previvified, but it matters for the
CPAN release.
Diffstat (limited to 'dist/Carp')
-rw-r--r-- | dist/Carp/lib/Carp.pm | 8 | ||||
-rw-r--r-- | dist/Carp/t/swash.t | 5 | ||||
-rw-r--r-- | dist/Carp/t/vivify_gv.t | 17 | ||||
-rw-r--r-- | dist/Carp/t/vivify_stash.t | 9 |
4 files changed, 24 insertions, 15 deletions
diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm index b4dce03e2b..658f24045b 100644 --- a/dist/Carp/lib/Carp.pm +++ b/dist/Carp/lib/Carp.pm @@ -6,8 +6,8 @@ use warnings; BEGIN { no strict "refs"; - if(exists($::{"utf8::"}) && exists($utf8::{"is_utf8"}) && - defined(*{"utf8::is_utf8"}{CODE})) { + if(exists($::{"utf8::"}) && exists(*{$::{"utf8::"}}{HASH}->{"is_utf8"}) && + defined(*{*{$::{"utf8::"}}{HASH}->{"is_utf8"}}{CODE})) { *is_utf8 = \&{"utf8::is_utf8"}; } else { *is_utf8 = sub { 0 }; @@ -16,8 +16,8 @@ BEGIN { BEGIN { no strict "refs"; - if(exists($::{"utf8::"}) && exists($utf8::{"downgrade"}) && - defined(*{"utf8::downgrade"}{CODE})) { + if(exists($::{"utf8::"}) && exists(*{$::{"utf8::"}}{HASH}->{"downgrade"}) && + defined(*{*{$::{"utf8::"}}{HASH}->{"downgrade"}}{CODE})) { *downgrade = \&{"utf8::downgrade"}; } else { *downgrade = sub {}; diff --git a/dist/Carp/t/swash.t b/dist/Carp/t/swash.t new file mode 100644 index 0000000000..7ef0bc81cf --- /dev/null +++ b/dist/Carp/t/swash.t @@ -0,0 +1,5 @@ +BEGIN { print "1..1\n"; } +use Carp; +my $x = "foo\x{666}"; $x =~ /foo\p{Alnum}/; +print "ok 1\n"; +1; diff --git a/dist/Carp/t/vivify_gv.t b/dist/Carp/t/vivify_gv.t index fdc018324b..3ed9912093 100644 --- a/dist/Carp/t/vivify_gv.t +++ b/dist/Carp/t/vivify_gv.t @@ -1,16 +1,11 @@ -use warnings; -use strict; +BEGIN { print "1..2\n"; } -our $has_is_utf8; -BEGIN { $has_is_utf8 = exists($utf8::{"is_utf8"}); } +our $has_is_utf8; BEGIN { $has_is_utf8 = exists($utf8::{"is_utf8"}); } +our $has_dgrade; BEGIN { $has_dgrade = exists($utf8::{"downgrade"}); } -our $has_downgrade; -BEGIN { $has_downgrade = exists($utf8::{"downgrade"}); } +use Carp; -use Test::More tests => 3; - -BEGIN { use_ok "Carp"; } -ok(!(exists($utf8::{"is_utf8"}) xor $has_is_utf8)); -ok(!(exists($utf8::{"downgrade"}) xor $has_downgrade)); +print !(exists($utf8::{"is_utf8"}) xor $has_is_utf8) ? "" : "not ", "ok 1\n"; +print !(exists($utf8::{"downgrade"}) xor $has_dgrade) ? "" : "not ", "ok 2\n"; 1; diff --git a/dist/Carp/t/vivify_stash.t b/dist/Carp/t/vivify_stash.t new file mode 100644 index 0000000000..7906748a4f --- /dev/null +++ b/dist/Carp/t/vivify_stash.t @@ -0,0 +1,9 @@ +BEGIN { print "1..1\n"; } + +our $has_utf8; BEGIN { $has_utf8 = exists($::{"utf8::"}); } + +use Carp; + +print !(exists($::{"utf8::"}) xor $has_utf8) ? "" : "not ", "ok 1\n"; + +1; |