$\1 and serious bug in evalling
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index cf78f86..b8f363c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -831,8 +831,11 @@ OP *op;
        for (kid = cLISTOP->op_first; kid; kid = kid->op_sibling)
            scalarvoid(kid);
        break;
+    case OP_ENTEREVAL:
+       scalarkids(op);
+       break;
     case OP_REQUIRE:
-       /* since all requires must return a value, they're never void */
+       /* all requires must return a boolean value */
        op->op_flags &= ~OPf_WANT;
        return scalar(op);
     case OP_SPLIT:
@@ -918,6 +921,10 @@ OP *op;
        }
        curcop = &compiling;
        break;
+    case OP_REQUIRE:
+       /* all requires must return a boolean value */
+       op->op_flags &= ~OPf_WANT;
+       return scalar(op);
     }
     return op;
 }
@@ -978,6 +985,7 @@ I32 type;
 
     switch (op->op_type) {
     case OP_UNDEF:
+       modcount++;
        return op;
     case OP_CONST:
        if (!(op->op_private & (OPpCONST_ARYBASE)))
@@ -1051,6 +1059,8 @@ I32 type;
 
     case OP_RV2AV:
     case OP_RV2HV:
+       if (!type && cUNOP->op_first->op_type != OP_GV)
+           croak("Can't localize through a reference");
        if (type == OP_REFGEN && op->op_flags & OPf_PARENS) {
            modcount = 10000;
            return op;          /* Treat \(@foo) like ordinary list. */
@@ -1072,7 +1082,7 @@ I32 type;
        break;
     case OP_RV2SV:
        if (!type && cUNOP->op_first->op_type != OP_GV)
-           croak("Can't localize a reference");
+           croak("Can't localize through a reference");
        ref(cUNOP->op_first, op->op_type); 
        /* FALL THROUGH */
     case OP_GV:
@@ -1543,6 +1553,16 @@ register OP *o;
     if (!(opargs[type] & OA_FOLDCONST))
        goto nope;
 
+    switch (type) {
+    case OP_SPRINTF:
+    case OP_UCFIRST:
+    case OP_LCFIRST:
+    case OP_UC:
+    case OP_LC:
+       if (o->op_private & OPpLOCALE)
+           goto nope;
+    }
+
     if (error_count)
        goto nope;              /* Don't try to run w/ errors */
 
@@ -2001,6 +2021,7 @@ OP *repl;
     if (op->op_type == OP_TRANS)
        return pmtrans(op, expr, repl);
 
+    hints |= HINT_BLOCK_SCOPE;
     pm = (PMOP*)op;
 
     if (expr->op_type == OP_CONST) {
@@ -2930,6 +2951,7 @@ CV *cv;
        CvROOT(cv) = Nullop;
        LEAVE;
     }
+    SvPOK_off((SV*)cv);                /* forget prototype */
     CvFLAGS(cv) = 0;
     SvREFCNT_dec(CvGV(cv));
     CvGV(cv) = Nullgv;
@@ -3231,6 +3253,9 @@ OP *block;
                SAVEFREESV(compcv);
                goto done;
            }
+           /* ahem, death to those who redefine active sort subs */
+           if (curstack == sortstack && sortcop == CvSTART(cv))
+               croak("Can't redefine active sort subroutine %s", name);
            const_sv = cv_const_sv(cv);
            if (const_sv || dowarn) {
                line_t oldline = curcop->cop_line;
@@ -4272,8 +4297,7 @@ OP *
 ck_match(op)
 OP *op;
 {
-    cPMOP->op_pmflags |= PMf_RUNTIME;
-    cPMOP->op_pmpermflags |= PMf_RUNTIME;
+    op->op_private |= OPpRUNTIME;
     return op;
 }