Change 12550 by gsar@moonru on 2001/10/21 19:05:54

        change#12549 wasn't aware of strictures

Affected files ...

... //depot/maint-5.6/perl/t/pragma/strict-vars#6 edit
... //depot/maint-5.6/perl/toke.c#65 edit

Differences ...

==== //depot/maint-5.6/perl/t/pragma/strict-vars#6 (text) ====
Index: perl/t/pragma/strict-vars
--- perl/t/pragma/strict-vars.~1~       Sun Oct 21 13:15:05 2001
+++ perl/t/pragma/strict-vars   Sun Oct 21 13:15:05 2001
@@ -399,6 +399,20 @@
 Name "Foo::foo" used only once: possible typo at - line 11.
 ########
 
+--FILE-- abc
+ok
+--FILE-- 
+# check if our variables are introduced correctly in readline()
+package Foo;
+use strict 'vars';
+our $FH;
+open $FH, "abc" or die "Can't open 'abc': $!";
+print <$FH>;
+close $FH;
+EXPECT
+ok
+########
+
 # Make sure the strict vars failure still occurs
 # now that the `@i should be written as \@i' failure does not occur
 # 20000522 [EMAIL PROTECTED] (MJD)

==== //depot/maint-5.6/perl/toke.c#65 (text) ====
Index: perl/toke.c
--- perl/toke.c.~1~     Sun Oct 21 13:15:05 2001
+++ perl/toke.c Sun Oct 21 13:15:05 2001
@@ -6568,15 +6568,30 @@
            /* try to find it in the pad for this block, otherwise find
               add symbol table ops
            */
-           if ((tmp = pad_findmy(d)) != NOT_IN_PAD
-               && !(SvFLAGS(AvARRAY(PL_comppad_name)[tmp]) & SVpad_OUR))
-           {
-               OP *o = newOP(OP_PADSV, 0);
-               o->op_targ = tmp;
-               PL_lex_op = (OP*)newUNOP(OP_READLINE, 0, o);
+           if ((tmp = pad_findmy(d)) != NOT_IN_PAD) {
+               SV *namesv = AvARRAY(PL_comppad_name)[tmp];
+               if (SvFLAGS(namesv) & SVpad_OUR) {
+                   SV *sym = sv_2mortal(newSVpv(HvNAME(GvSTASH(namesv)),0));
+                   sv_catpvn(sym, "::", 2);
+                   sv_catpv(sym, d+1);
+                   d = SvPVX(sym);
+                   goto intro_sym;
+               }
+               else {
+                   OP *o = newOP(OP_PADSV, 0);
+                   o->op_targ = tmp;
+                   PL_lex_op = (OP*)newUNOP(OP_READLINE, 0, o);
+               }
            }
            else {
-               GV *gv = gv_fetchpv(d+1,TRUE, SVt_PV);
+               GV *gv;
+               ++d;
+intro_sym:
+               gv = gv_fetchpv(d,
+                               (PL_in_eval
+                                ? (GV_ADDMULTI | GV_ADDINEVAL)
+                                : TRUE),
+                               SVt_PV);
                PL_lex_op = (OP*)newUNOP(OP_READLINE, 0,
                                            newUNOP(OP_RV2SV, 0,
                                                newGVOP(OP_GV, 0, gv)));
End of Patch.

Reply via email to