additional tests for utf8.t
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index d2e795f..2308d35 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -883,15 +883,18 @@ PP(pp_sort)
 
            CATCH_SET(TRUE);
            PUSHSTACKi(PERLSI_SORT);
-           if (PL_sortstash != stash) {
-               PL_firstgv = gv_fetchpv("a", TRUE, SVt_PV);
-               PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
-               PL_sortstash = stash;
+           if (!hasargs && !is_xsub) {
+               if (PL_sortstash != stash || !PL_firstgv || !PL_secondgv) {
+                   SAVESPTR(PL_firstgv);
+                   SAVESPTR(PL_secondgv);
+                   PL_firstgv = gv_fetchpv("a", TRUE, SVt_PV);
+                   PL_secondgv = gv_fetchpv("b", TRUE, SVt_PV);
+                   PL_sortstash = stash;
+               }
+               SAVESPTR(GvSV(PL_firstgv));
+               SAVESPTR(GvSV(PL_secondgv));
            }
 
-           SAVESPTR(GvSV(PL_firstgv));
-           SAVESPTR(GvSV(PL_secondgv));
-
            PUSHBLOCK(cx, CXt_NULL, PL_stack_base);
            if (!(PL_op->op_flags & OPf_SPECIAL)) {
                cx->cx_type = CXt_SUB;
@@ -2762,6 +2765,7 @@ S_doeval(pTHX_ int gimme, OP** startop)
     SAVESPTR(PL_beginav);
     PL_beginav = newAV();
     SAVEFREESV(PL_beginav);
+    SAVEI32(PL_error_count);
 
     /* try to compile it */
 
@@ -3261,9 +3265,11 @@ PP(pp_entereval)
     SAVEHINTS();
     PL_hints = PL_op->op_targ;
     SAVESPTR(PL_compiling.cop_warnings);
-    if (!specialWARN(PL_compiling.cop_warnings)) {
-        PL_compiling.cop_warnings = newSVsv(PL_compiling.cop_warnings) ;
-        SAVEFREESV(PL_compiling.cop_warnings) ;
+    if (specialWARN(PL_curcop->cop_warnings))
+        PL_compiling.cop_warnings = PL_curcop->cop_warnings;
+    else {
+        PL_compiling.cop_warnings = newSVsv(PL_curcop->cop_warnings);
+        SAVEFREESV(PL_compiling.cop_warnings);
     }
 
     push_return(PL_op->op_next);