Revert change 26410, marking the test that was added there as TODO.
Nicholas Clark [Wed, 18 Jan 2006 21:30:00 +0000 (21:30 +0000)]
See the thread :
Subject: LVALUE m//g (was Re: au revoir ...)
Message-ID: <20060118203058.GQ616@plum.flirble.org>

p4raw-id: //depot/perl@26926

op.c

diff --git a/op.c b/op.c
index 710d657..966cf84 100644 (file)
--- a/op.c
+++ b/op.c
@@ -1157,9 +1157,8 @@ Perl_mod(pTHX_ OP *o, I32 type)
        /* FALL THROUGH */
     default:
       nomod:
-       /* grep, foreach, subcalls, refgen, m//g */
-       if (type == OP_GREPSTART || type == OP_ENTERSUB || type == OP_REFGEN
-           || type == OP_MATCH)
+       /* grep, foreach, subcalls, refgen */
+       if (type == OP_GREPSTART || type == OP_ENTERSUB || type == OP_REFGEN)
            break;
        yyerror(Perl_form(aTHX_ "Can't modify %s in %s",
                     (o->op_type == OP_NULL && (o->op_flags & OPf_SPECIAL)
@@ -1841,14 +1840,9 @@ Perl_bind_match(pTHX_ I32 type, OP *left, OP *right)
     }
     if (!(right->op_flags & OPf_STACKED) && ismatchop) {
        right->op_flags |= OPf_STACKED;
-       /* s/// and tr/// modify their arg.
-        * m//g also indirectly modifies the arg by setting pos magic on it */
-       if (   (right->op_type == OP_MATCH &&
-                   (cPMOPx(right)->op_pmflags & PMf_GLOBAL))
-           || (right->op_type == OP_SUBST)
-           || (right->op_type == OP_TRANS &&
-               ! (right->op_private & OPpTRANS_IDENTICAL))
-       )
+       if (right->op_type != OP_MATCH &&
+            ! (right->op_type == OP_TRANS &&
+               right->op_private & OPpTRANS_IDENTICAL))
            left = mod(left, right->op_type);
        if (right->op_type == OP_TRANS)
            o = newBINOP(OP_NULL, OPf_STACKED, scalar(left), right);