diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-11-25 12:57:04 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-27 07:05:02 -0800 |
commit | 1a904fc88069e249a4bd0ef196a3f1a7f549e0fe (patch) | |
tree | de28df537caeee6b88185d7beb1305d5b8b55dfb /gv.c | |
parent | 07d01d6ec25527bf0236de2205ea412d40353058 (diff) | |
download | perl-1a904fc88069e249a4bd0ef196a3f1a7f549e0fe.tar.gz |
Disable PL_sawampersand
PL_sawampersand actually causes bugs (e.g., perl #4289), because the
behaviour changes. eval '$&' after a match will produce different
results depending on whether $& was seen before the match.
Using copy-on-write for the pre-match copy (preceding patches do that)
alleviates the slowdown caused by mentioning $&. The copy doesn’t
happen unless the string is modified after the match. It’s now a
post- match copy. So we no longer need to do things differently
depending on whether $& has been seen.
PL_sawampersand is now #defined to be equal to what it would be if
every program began with $',$&,$`.
I left the PL_sawampersand code in place, in case this commit proves
immature. Running Configure with -Accflags=PERL_SAWAMPERSAND will
reënable the PL_sawampersand mechanism.
Diffstat (limited to 'gv.c')
-rw-r--r-- | gv.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1638,6 +1638,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, case '[': require_tie_mod(gv,name,newSVpvs("arybase"),"FETCH",0); break; +#ifdef PERL_SAWAMPERSAND case '`': PL_sawampersand |= SAWAMPERSAND_LEFT; (void)GvSVn(gv); @@ -1650,6 +1651,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, PL_sawampersand |= SAWAMPERSAND_RIGHT; (void)GvSVn(gv); break; +#endif } } } @@ -1854,6 +1856,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, case '&': /* $& */ case '`': /* $` */ case '\'': /* $' */ +#ifdef PERL_SAWAMPERSAND if (!( sv_type == SVt_PVAV || sv_type == SVt_PVHV || @@ -1867,6 +1870,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags, ? SAWAMPERSAND_MIDDLE : SAWAMPERSAND_RIGHT; } +#endif goto magicalize; case ':': /* $: */ |