summaryrefslogtreecommitdiff
path: root/t/pragma/strict-vars
diff options
context:
space:
mode:
Diffstat (limited to 't/pragma/strict-vars')
-rw-r--r--t/pragma/strict-vars32
1 files changed, 32 insertions, 0 deletions
diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars
index b8108d278c..dc11f5d59e 100644
--- a/t/pragma/strict-vars
+++ b/t/pragma/strict-vars
@@ -307,3 +307,35 @@ print our $fred,"\n";
EXPECT
2
1
+########
+
+# "nailed" our declaration visibility across package boundaries
+use strict 'vars';
+our $foo;
+$foo = 20;
+package Foo;
+print $foo, "\n";
+EXPECT
+20
+########
+
+# multiple our declarations in same scope, different packages, no warning
+use strict 'vars';
+use warnings;
+our $foo;
+${foo} = 10;
+package Foo;
+our $foo = 20;
+print $foo, "\n";
+EXPECT
+20
+########
+
+# multiple our declarations in same scope, same package, warning
+use strict 'vars';
+use warnings;
+our $foo;
+${foo} = 10;
+our $foo;
+EXPECT
+"our" variable $foo masks earlier declaration in same scope at - line 7.