summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-02-08 12:45:12 -0800
committerFather Chrysostomos <sprout@cpan.org>2015-02-08 14:53:11 -0800
commitddce084af02764d4f30ef6089ae67a7983fcc690 (patch)
tree944bcec5805cb989ada4e52d0af81283d1d7fa04 /mg.c
parentdec5203ab08acacda6ed98fd23a8dc4e5b190239 (diff)
downloadperl-ddce084af02764d4f30ef6089ae67a7983fcc690.tar.gz
Remove get-magic from $/
and use a different approach to prevent $/ from being set to a bad value. This should fix ticket #123739. Commit v5.21.8-197-g5fe499a made $/’s get-magic read PL_rs, so that the croak when setting $/ to a bad value would not leave $/ with that bad value, in order to fix bug #123218. Some CPAN modules do not like $/ reading PL_rs that way. So we have to change this back. I am not actually removing the get- magic, but just making it a no-op, as it was before. The set- magic now sets $/ back to its previous value before croaking.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index 237b404c86..d2a8db008a 100644
--- a/mg.c
+++ b/mg.c
@@ -1103,9 +1103,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setiv(sv, (IV)IoPAGE(GvIOp(PL_defoutgv)));
break;
case ':':
- break;
case '/':
- sv_setsv(sv, PL_rs);
break;
case '[':
sv_setiv(sv, 0);
@@ -2869,6 +2867,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
);
}
} else {
+ sv_setsv(sv, PL_rs);
/* diag_listed_as: Setting $/ to %s reference is forbidden */
Perl_croak(aTHX_ "Setting $/ to a%s %s reference is forbidden",
*reftype == 'A' ? "n" : "", reftype);