Fix breakages that prevended -DPERL_POISON from compiling.
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index 2ca186c..a3dee91 100644 (file)
--- a/op.c
+++ b/op.c
@@ -211,11 +211,13 @@ Perl_allocmy(pTHX_ char *name)
     PADOFFSET off;
 
     /* complain about "my $<special_var>" etc etc */
-    if (!(PL_in_my == KEY_our ||
+    if (*name &&
+       !(PL_in_my == KEY_our ||
          isALPHA(name[1]) ||
          (USE_UTF8_IN_NAMES && UTF8_IS_START(name[1])) ||
-         (name[1] == '_' && (*name == '$' || (int)strlen(name) > 2))))
+         (name[1] == '_' && (*name == '$' || name[2]))))
     {
+       /* name[2] is true if strlen(name) > 2  */
        if (!isPRINT(name[1]) || strchr("\t\n\r\f", name[1])) {
            /* 1999-02-27 mjd@plover.com */
            char *p;
@@ -4536,8 +4538,10 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
            goto done;
 
        if (strEQ(s, "BEGIN") && !PL_error_count) {
+           dSP;
            const I32 oldscope = PL_scopestack_ix;
            ENTER;
+           PUSHSTACKi(PERLSI_REQUIRE);
            SAVECOPFILE(&PL_compiling);
            SAVECOPLINE(&PL_compiling);
 
@@ -4550,6 +4554,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
 
            PL_curcop = &PL_compiling;
            PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+           POPSTACK;
            LEAVE;
        }
        else if (strEQ(s, "END") && !PL_error_count) {