summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2012-02-03 10:53:00 +0000
committerZefram <zefram@fysh.org>2012-02-03 10:53:00 +0000
commit778a861bb0a8d42e4be677cc40a39d1fac0babe5 (patch)
tree7a62bfeccdf86e1de06ca50ad1310ab9301a0de9
parent864fd8d30af274c82a36ddaf90ed55c91f64ebc7 (diff)
downloadperl-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.
-rw-r--r--MANIFEST2
-rw-r--r--dist/Carp/lib/Carp.pm8
-rw-r--r--dist/Carp/t/swash.t5
-rw-r--r--dist/Carp/t/vivify_gv.t17
-rw-r--r--dist/Carp/t/vivify_stash.t9
5 files changed, 26 insertions, 15 deletions
diff --git a/MANIFEST b/MANIFEST
index 5c06411f5a..0295b7c5ab 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3050,7 +3050,9 @@ dist/Carp/lib/Carp.pm Error message extension
dist/Carp/Makefile.PL makefile writer for Carp
dist/Carp/t/Carp.t See if Carp works
dist/Carp/t/heavy.t See if Carp::Heavy works
+dist/Carp/t/swash.t See if Carp avoids breaking swash loading
dist/Carp/t/vivify_gv.t See if Carp leaves utf8:: stuff alone
+dist/Carp/t/vivify_stash.t See if Carp leaves utf8:: stash alone
dist/constant/lib/constant.pm For "use constant"
dist/constant/t/constant.t See if compile-time constants work
dist/constant/t/utf8.t Test Unicode constants under utf8 pragma
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;