From: Ricardo SIGNES <rjbs@cpan.org>
Date: Wed, 14 Nov 2007 15:34:30 +0000 (-0500)
Subject: perlsub's docs on state assignment are busted
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f292fc7a7d8460bfc8c09d1cb38f8427574bdfaa;p=p5sagit%2Fp5-mst-13.2.git

perlsub's docs on state assignment are busted
Message-ID: <20071114203430.GA7191@zodiac.codesimply.com>

p4raw-id: //depot/perl@32325
---

diff --git a/pod/perlsub.pod b/pod/perlsub.pod
index fed1474..72b28f1 100644
--- a/pod/perlsub.pod
+++ b/pod/perlsub.pod
@@ -453,11 +453,10 @@ each time the gimme_another() function is called:
 Also, since C<$x> is lexical, it can't be reached or modified by any Perl
 code outside.
 
-Be aware that assignment to C<state> variables (as in C<state $x = 42>)
-are executed every time; to initialize (or re-initialize) an undefined
-state scalar, you can use, for example, the defined-or assignment :
-
-    state $x //= initial_value();
+When combined with variable declaration, simple scalar assignment to C<state>
+variables (as in C<state $x = 42>) is executed only the first time.  When such
+statements are evaluated subsequent times, the assignment is ignored.  The
+behavior of this sort of assignment to non-scalar variables is undefined.
 
 =head3 Persistent variables with closures