summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pad.c9
-rw-r--r--t/comp/our.t12
-rw-r--r--toke.c4
3 files changed, 16 insertions, 9 deletions
diff --git a/pad.c b/pad.c
index 0eea55c318..09dd568cd2 100644
--- a/pad.c
+++ b/pad.c
@@ -552,13 +552,8 @@ Perl_pad_findmy(pTHX_ char *name)
continue;
}
else {
- if (
- ( seq > (U32)I_32(SvNVX(sv)) /* min */
- && seq <= (U32)SvIVX(sv)) /* max */
- ||
- /* 'our' is visible before introduction */
- (!SvIVX(sv) && (SvFLAGS(sv) & SVpad_OUR))
- )
+ if ( seq > (U32)I_32(SvNVX(sv)) /* min */
+ && seq <= (U32)SvIVX(sv)) /* max */
return off;
}
}
diff --git a/t/comp/our.t b/t/comp/our.t
index 8029f613c5..69fbb03121 100644
--- a/t/comp/our.t
+++ b/t/comp/our.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-print "1..6\n";
+print "1..7\n";
{
package TieAll;
@@ -48,3 +48,13 @@ is(TieAll->calls, '', 'our @x has no runtime effect');
{our (@x);}
is(TieAll->calls, '', 'our (@x) has no runtime effect');
+
+
+$y = 1;
+{
+ my $y = 2;
+ {
+ our $y = $y;
+ is($y, 2, 'our shouldnt be visible until introduced')
+ }
+}
diff --git a/toke.c b/toke.c
index 641e3e37b3..b879815393 100644
--- a/toke.c
+++ b/toke.c
@@ -5279,7 +5279,9 @@ S_pending_ident(pTHX)
*/
if (!strchr(PL_tokenbuf,':')) {
- if ((tmp = pad_findmy(PL_tokenbuf)) != NOT_IN_PAD) {
+ if (!PL_in_my)
+ tmp = pad_findmy(PL_tokenbuf);
+ if (tmp != NOT_IN_PAD) {
/* might be an "our" variable" */
if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
/* build ops for a bareword */