In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/ecafefb82337acf1046f535da14a6fc0293f70b5?hp=94708f6d9bd9347f0cbb485f61d2f74215b62fd4>

- Log -----------------------------------------------------------------
commit ecafefb82337acf1046f535da14a6fc0293f70b5
Author: Aristotle Pagaltzis <[email protected]>
Date:   Tue Dec 2 04:05:20 2014 +0100

    perlfunc: document immediate stricture effect of "our"
-----------------------------------------------------------------------

Summary of changes:
 pod/perlfunc.pod | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 9347b60..5fe4b3d 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -4369,7 +4369,8 @@ existing variable: a package variable of the same name.
 
 This means that when C<use strict 'vars'> is in effect, C<our> lets you use
 a package variable without qualifying it with the package name, but only within
-the lexical scope of the C<our> declaration.
+the lexical scope of the C<our> declaration. This applies immediately--even
+within the same statement.
 
     package Foo;
     use strict;
@@ -4395,6 +4396,16 @@ package variables spring into existence when first used.
 
     print $Foo::foo; # prints 23
 
+Because the variable becomes legal immediately under C<use strict 'vars'>, so
+long as there is no variable with that name is already in scope, you can then
+reference the package variable again even within the same statement.
+
+    package Foo;
+    use strict;
+
+    my  $foo = $foo; # error, undeclared $foo on right-hand side
+    our $foo = $foo; # no errors
+
 If more than one variable is listed, the list must be placed
 in parentheses.
 

--
Perl5 Master Repository

Reply via email to