*.pod changes based on the FAQ
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index f27aa94..2784a54 100644 (file)
--- a/op.c
+++ b/op.c
@@ -389,7 +389,7 @@ pad_sv(PADOFFSET po)
 {
     if (!po)
        croak("panic: pad_sv po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %lu\n", (unsigned long)po));
     return curpad[po];         /* eventually we'll turn this into a macro */
 }
 
@@ -407,7 +407,7 @@ pad_free(PADOFFSET po)
        croak("panic: pad_free curpad");
     if (!po)
        croak("panic: pad_free po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %lu\n", (unsigned long)po));
     if (curpad[po] && !SvIMMORTAL(curpad[po]))
        SvPADTMP_off(curpad[po]);
     if ((I32)po < padix)
@@ -426,7 +426,7 @@ pad_swipe(PADOFFSET po)
        croak("panic: pad_swipe curpad");
     if (!po)
        croak("panic: pad_swipe po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %lu\n", (unsigned long)po));
     SvPADTMP_off(curpad[po]);
     curpad[po] = NEWSV(1107,0);
     SvPADTMP_on(curpad[po]);
@@ -1264,6 +1264,20 @@ OP *right;
 {
     OP *op;
 
+    if (dowarn &&
+       (left->op_type == OP_RV2AV ||
+        left->op_type == OP_RV2HV ||
+        left->op_type == OP_PADAV ||
+        left->op_type == OP_PADHV)) {
+       char *desc = op_desc[(right->op_type == OP_SUBST ||
+                             right->op_type == OP_TRANS)
+                            ? right->op_type : OP_MATCH];
+       char *sample = ((left->op_type == OP_RV2AV ||
+                        left->op_type == OP_PADAV)
+                       ? "@array" : "%hash");
+       warn("Applying %s to %s will act on scalar(%s)", desc, sample, sample);
+    }
+
     if (right->op_type == OP_MATCH ||
        right->op_type == OP_SUBST ||
        right->op_type == OP_TRANS) {
@@ -3192,6 +3206,7 @@ OP *block;
        else
            s = name;
        if (strEQ(s, "BEGIN") && !error_count) {
+           I32 oldscope = scopestack_ix;
            ENTER;
            SAVESPTR(compiling.cop_filegv);
            SAVEI16(compiling.cop_line);
@@ -3204,7 +3219,7 @@ OP *block;
            DEBUG_x( dump_sub(gv) );
            av_push(beginav, (SV *)cv);
            GvCV(gv) = 0;
-           calllist(beginav);
+           calllist(oldscope, beginav);
 
            curcop = &compiling;
            LEAVE;
@@ -4399,7 +4414,6 @@ OP *op;
        }
        else
            list(o);
-       mod(o, OP_ENTERSUB);
        prev = o;
        o = o->op_sibling;
     }