summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-09 18:36:39 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-11 07:41:26 -0700
commit958851d8f0bcfcbfc1dd2ad9e869430180974b69 (patch)
tree964f0126697b91e37ee0750f4a01ca19dd8b2b30 /pp_hot.c
parent9ff3e6d8e1976c0d05c130c992864d16ab35ce39 (diff)
downloadperl-958851d8f0bcfcbfc1dd2ad9e869430180974b69.tar.gz
Read-only COWs should not be exempt from s/// croaking
$ ./miniperl -Ilib -e 'for(__PACKAGE__) { s/a/a/ }' Modification of a read-only value attempted at -e line 1. $ ./miniperl -Ilib -e 'for(__PACKAGE__) { s/b/b/ }' $ ./miniperl -Ilib -e 'for("main") { s/a/a/ }' Modification of a read-only value attempted at -e line 1. $ ./miniperl -Ilib -e 'for("main") { s/b/b/ }' Modification of a read-only value attempted at -e line 1. When I pass the constant "main" to s///, it croaks whether the regular expression matches or not. When I pass __PACKAGE__, which has the same content and is also read- only, it only croaks when the pattern matches. This commit removes some logic that is left over from when READONLY+FAKE meant copy-on-write. Read-only does mean read-only now, so copy-on-write scalars should not be exempt from read-only checks.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 5010606ee0..3adeb1e8f7 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2058,9 +2058,6 @@ PP(pp_subst)
sv_force_normal_flags(TARG,0);
#endif
if (!(rpm->op_pmflags & PMf_NONDESTRUCT)
-#ifdef PERL_ANY_COW
- && !is_cow
-#endif
&& (SvREADONLY(TARG)
|| ( ((SvTYPE(TARG) == SVt_PVGV && isGV_with_GP(TARG))
|| SvTYPE(TARG) > SVt_PVLV)