summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-12 12:24:29 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-12 13:00:02 -0700
commitfa819c1ce3252e7ae97e9cdd4d3d0dd1edb06fa1 (patch)
tree9de6862f1c09e08526ecb4c315aec824c6f82b8e /ext
parent21690b721fd5cd765bcc0330aa94f9172c24582d (diff)
downloadperl-fa819c1ce3252e7ae97e9cdd4d3d0dd1edb06fa1.tar.gz
Make SvIsCOW honest about globs
SvIsCOW was ignoring the fact that it might be passed a typeglob, which made its behaviour contradict its docs. This fixes that and, in doing so, simplifies the upcoming Internals::SvREADONLY fix.
Diffstat (limited to 'ext')
-rw-r--r--ext/XS-APItest/APItest.xs7
-rw-r--r--ext/XS-APItest/t/sviscow.t13
2 files changed, 20 insertions, 0 deletions
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index acd1b5e42f..68533da58b 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -2858,6 +2858,13 @@ CODE:
HeVAL(entry) = NULL;
}
+bool
+SvIsCOW(SV *sv)
+CODE:
+ RETVAL = SvIsCOW(sv);
+OUTPUT:
+ RETVAL
+
MODULE = XS::APItest PACKAGE = XS::APItest::Magic
PROTOTYPES: DISABLE
diff --git a/ext/XS-APItest/t/sviscow.t b/ext/XS-APItest/t/sviscow.t
new file mode 100644
index 0000000000..bcc9da8ebd
--- /dev/null
+++ b/ext/XS-APItest/t/sviscow.t
@@ -0,0 +1,13 @@
+use strict;
+use warnings; no warnings 'once';
+
+use Test::More tests => 1;
+
+use XS::APItest;
+use Hash::Util 'lock_value';
+
+my %h;
+$h{g} = *foo;
+lock_value %h, 'g';
+
+ok(!SvIsCOW($h{g}), 'SvIsCOW is honest when it comes to globs');