diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-14 04:16:51 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-14 04:16:51 +0000 |
commit | f472eb5c07ed95306a11c98250bda17aae994339 (patch) | |
tree | ec0f98c535a7112418134f68146d78b4344ec604 /t/pragma | |
parent | 192587c2153e5b0fa4ed545cdd3fa7fef8fc0d8b (diff) | |
download | perl-f472eb5c07ed95306a11c98250bda17aae994339.tar.gz |
nailed "our" declarations, and better warnings on duplicate
"our" declarations
p4raw-id: //depot/perl@4801
Diffstat (limited to 't/pragma')
-rw-r--r-- | t/pragma/strict-vars | 32 |
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. |