Change 23608 by [EMAIL PROTECTED] on 2004/12/03 21:51:45

        $foo::_ was wrongly forced as $main::_.
        Since we still want "our $_" to be always forced to $main::_,
        deplace the forcing code at our-pad allocation time.
        (Making execution probably a tiny bit faster)

Affected files ...

... //depot/perl/gv.c#210 edit
... //depot/perl/op.c#642 edit
... //depot/perl/t/op/mydef.t#6 edit

Differences ...

==== //depot/perl/gv.c#210 (text) ====
Index: perl/gv.c
--- perl/gv.c#209~23605~        Fri Dec  3 10:56:31 2004
+++ perl/gv.c   Fri Dec  3 13:51:45 2004
@@ -702,10 +702,6 @@
     }
     len = namend - name;
 
-    /* $_ should always be in main:: even when our'ed */
-    if (*name == '_' && !name[1])
-       stash = PL_defstash;
-
     /* No stash in name, so see how we can default */
 
     if (!stash) {

==== //depot/perl/op.c#642 (text) ====
Index: perl/op.c
--- perl/op.c#641~23499~        Tue Nov 16 01:42:50 2004
+++ perl/op.c   Fri Dec  3 13:51:45 2004
@@ -256,7 +256,8 @@
     off = pad_add_name(name,
                    PL_in_my_stash,
                    (PL_in_my == KEY_our 
-                       ? (PL_curstash ? PL_curstash : PL_defstash)
+                       /* $_ is always in main::, even with our */
+                       ? (PL_curstash && !strEQ(name,"$_") ? PL_curstash : 
PL_defstash)
                        : Nullhv
                    ),
                    0 /*  not fake */

==== //depot/perl/t/op/mydef.t#6 (text) ====
Index: perl/t/op/mydef.t
--- perl/t/op/mydef.t#5~22889~  Tue Jun  1 23:07:53 2004
+++ perl/t/op/mydef.t   Fri Dec  3 13:51:45 2004
@@ -5,7 +5,7 @@
     @INC = '../lib';
 }
 
-print "1..66\n";
+print "1..70\n";
 
 my $test = 0;
 sub ok ($$) {
@@ -188,4 +188,13 @@
     my $x = <$_>;
     ok( $x eq "hello\n", 'reading from <$_> works' );
     close $_;
+}
+
+{
+    $fqdb::_ = 'fqdb';
+    ok( $fqdb::_ eq 'fqdb', 'fully qualified $_ is not in main' );
+    ok( eval q/$fqdb::_/ eq 'fqdb', 'fully qualified, evaled $_ is not in 
main' );
+    package fqdb;
+    ::ok( $_ ne 'fqdb', 'unqualified $_ is in main' );
+    ::ok( q/$_/ ne 'fqdb', 'unqualified, evaled $_ is in main' );
 }
End of Patch.

Reply via email to