perldoc pod update
[p5sagit/p5-mst-13.2.git] / op.c
diff --git a/op.c b/op.c
index d673fad..6bfa1a1 100644 (file)
--- a/op.c
+++ b/op.c
@@ -219,6 +219,12 @@ pad_findlex(char *name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix, I32 s
                    SvNVX(namesv) = (double)PL_curcop->cop_seq;
                    SvIVX(namesv) = PAD_MAX;    /* A ref, intro immediately */
                    SvFAKE_on(namesv);          /* A ref, not a real var */
+                   if (SvOBJECT(sv)) {         /* A typed var */
+                       SvOBJECT_on(namesv);
+                       (void)SvUPGRADE(namesv, SVt_PVMG);
+                       SvSTASH(namesv) = (HV*)SvREFCNT_inc((SV*)SvSTASH(sv));
+                       PL_sv_objcount++;
+                   }
                    if (CvANON(PL_compcv) || SvTYPE(PL_compcv) == SVt_PVFM) {
                        /* "It's closures all the way down." */
                        CvCLONE_on(PL_compcv);
@@ -310,6 +316,7 @@ pad_findmy(char *name)
     SV **svp = AvARRAY(PL_comppad_name);
     U32 seq = PL_cop_seqmax;
     PERL_CONTEXT *cx;
+    CV *outside;
 
 #ifdef USE_THREADS
     /*
@@ -339,16 +346,20 @@ pad_findmy(char *name)
        }
     }
 
-    /* Check if if we're in an eval'', and adjust seq to be the eval's
-     * seq number */
-    if (cxstack_ix >= 0) {
+    outside = CvOUTSIDE(PL_compcv);
+
+    /* Check if if we're compiling an eval'', and adjust seq to be the
+     * eval's seq number.  This depends on eval'' having a non-null
+     * CvOUTSIDE() while it is being compiled.  The eval'' itself is
+     * identified by CvUNIQUE being set and CvGV being null. */
+    if (outside && CvUNIQUE(PL_compcv) && !CvGV(PL_compcv) && cxstack_ix >= 0) {
        cx = &cxstack[cxstack_ix];
        if (CxREALEVAL(cx))
            seq = cx->blk_oldcop->cop_seq;
     }
 
     /* See if it's in a nested scope */
-    off = pad_findlex(name, 0, seq, CvOUTSIDE(PL_compcv), cxstack_ix, 0);
+    off = pad_findlex(name, 0, seq, outside, cxstack_ix, 0);
     if (off) {
        /* If there is a pending local definition, this new alias must die */
        if (pendoff)
@@ -1912,7 +1923,7 @@ append_list(I32 type, LISTOP *first, LISTOP *last)
     first->op_last = last->op_last;
     first->op_children += last->op_children;
     if (first->op_children)
-       last->op_flags |= OPf_KIDS;
+       first->op_flags |= OPf_KIDS;
 
     Safefree(last);
     return (OP*)first;
@@ -3500,7 +3511,7 @@ CV* cv;
                  cv,
                  (CvANON(cv) ? "ANON"
                   : (cv == PL_main_cv) ? "MAIN"
-                  : CvUNIQUE(outside) ? "UNIQUE"
+                  : CvUNIQUE(cv) ? "UNIQUE"
                   : CvGV(cv) ? GvNAME(CvGV(cv)) : "UNDEFINED"),
                  outside,
                  (!outside ? "null"
@@ -3827,9 +3838,10 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block)
     CvSTASH(cv) = PL_curstash;
 #ifdef USE_THREADS
     CvOWNER(cv) = 0;
-    if (!CvMUTEXP(cv))
+    if (!CvMUTEXP(cv)) {
        New(666, CvMUTEXP(cv), 1, perl_mutex);
-    MUTEX_INIT(CvMUTEXP(cv));
+       MUTEX_INIT(CvMUTEXP(cv));
+    }
 #endif /* USE_THREADS */
 
     if (ps)