s/pp_dor/pp_defined/
[p5sagit/p5-mst-13.2.git] / pp_hot.c
index bf3e229..ef20f9e 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -324,38 +324,57 @@ PP(pp_or)
     }
 }
 
-PP(pp_dor)
+PP(pp_defined)
 {
-    /* Most of this is lifted straight from pp_defined */
     dSP;
-    register SV* const sv = TOPs;
-
-    if (!sv || !SvANY(sv)) {
-       --SP;
-       RETURNOP(cLOGOP->op_other);
+    register SV* sv;
+    bool defined = FALSE;
+    const int op_type = PL_op->op_type;
+
+    if(op_type == OP_DOR) {
+        sv = TOPs;
+        if (!sv || !SvANY(sv)) {
+            --SP;
+            RETURNOP(cLOGOP->op_other);
+        }
+    } else if (op_type == OP_DEFINED) {
+        sv = POPs;
+        if (!sv || !SvANY(sv))
+            RETPUSHNO;
     }
-    
+
     switch (SvTYPE(sv)) {
     case SVt_PVAV:
        if (AvMAX(sv) >= 0 || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
-           RETURN;
+           defined = TRUE;
        break;
     case SVt_PVHV:
        if (HvARRAY(sv) || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied)))
-           RETURN;
+           defined = TRUE;
        break;
     case SVt_PVCV:
        if (CvROOT(sv) || CvXSUB(sv))
-           RETURN;
+           defined = TRUE;
        break;
     default:
        SvGETMAGIC(sv);
        if (SvOK(sv))
-           RETURN;
+           defined = TRUE;
     }
     
-    --SP;
-    RETURNOP(cLOGOP->op_other);
+    if(defined) {
+         if(op_type == OP_DOR)
+             RETURN;
+         else if (op_type == OP_DEFINED) 
+             RETPUSHYES;
+    }
+
+    if(op_type == OP_DOR) {
+        --SP;
+        RETURNOP(cLOGOP->op_other);
+    } else if (op_type == OP_DEFINED) {
+        RETPUSHNO;
+    }
 }
 
 PP(pp_add)
@@ -1610,7 +1629,7 @@ Perl_do_readline(pTHX)
             const U8 *f;
             
             if (ckWARN(WARN_UTF8) &&
-                   !is_utf8_string_loc(aTHX_ s, len, &f))
+                   !is_utf8_string_loc(s, len, &f))
                  /* Emulate :encoding(utf8) warning in the same case. */
                  Perl_warner(aTHX_ packWARN(WARN_UTF8),
                              "utf8 \"\\x%02X\" does not map to Unicode",
@@ -2331,6 +2350,9 @@ PP(pp_leavesub)
     register PERL_CONTEXT *cx;
     SV *sv;
 
+    if (CxMULTICALL(&cxstack[cxstack_ix]))
+       return 0;
+
     POPBLOCK(cx,newpm);
     cxstack_ix++; /* temporarily protect top context */
 
@@ -2391,6 +2413,9 @@ PP(pp_leavesublv)
     register PERL_CONTEXT *cx;
     SV *sv;
 
+    if (CxMULTICALL(&cxstack[cxstack_ix]))
+       return 0;
+
     POPBLOCK(cx,newpm);
     cxstack_ix++; /* temporarily protect top context */