summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorGerard Goossen <gerard@ggoossen.net>2009-11-21 12:16:07 +0100
committerRafael Garcia-Suarez <rgs@consttype.org>2009-11-21 19:49:48 +0100
commitb500e03bf95eb884a53407409b4e755d303171a4 (patch)
tree2ea466912e5adede52f4d5b2907358ab8f9602cc /pod
parent021f53de09926928546378b3552f9240c9241dde (diff)
downloadperl-b500e03bf95eb884a53407409b4e755d303171a4.tar.gz
deprecate "goto" to jump into a construct
Diffstat (limited to 'pod')
-rw-r--r--pod/perlfunc.pod27
1 files changed, 15 insertions, 12 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index ddb5bceeef..fe2a8850c7 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -2392,18 +2392,15 @@ X<goto> X<jump> X<jmp>
=item goto &NAME
-The C<goto-LABEL> form finds the statement labeled with LABEL and resumes
-execution there. It may not be used to go into any construct that
-requires initialization, such as a subroutine or a C<foreach> loop. It
-also can't be used to go into a construct that is optimized away,
-or to get out of a block or subroutine given to C<sort>.
-It can be used to go almost anywhere else within the dynamic scope,
-including out of subroutines, but it's usually better to use some other
-construct such as C<last> or C<die>. The author of Perl has never felt the
-need to use this form of C<goto> (in Perl, that is--C is another matter).
-(The difference being that C does not offer named loops combined with
-loop control. Perl does, and this replaces most structured uses of C<goto>
-in other languages.)
+The C<goto-LABEL> form finds the statement labeled with LABEL and
+resumes execution there. It can't be used to get out of a block or
+subroutine given to C<sort>. It can be used to go almost anywhere
+else within the dynamic scope, including out of subroutines, but it's
+usually better to use some other construct such as C<last> or C<die>.
+The author of Perl has never felt the need to use this form of C<goto>
+(in Perl, that is--C is another matter). (The difference being that C
+does not offer named loops combined with loop control. Perl does, and
+this replaces most structured uses of C<goto> in other languages.)
The C<goto-EXPR> form expects a label name, whose scope will be resolved
dynamically. This allows for computed C<goto>s per FORTRAN, but isn't
@@ -2411,6 +2408,12 @@ necessarily recommended if you're optimizing for maintainability:
goto ("FOO", "BAR", "GLARCH")[$i];
+Use of C<goto-LABEL> or C<goto-EXPR> to jump into a construct is
+deprecated and will issue a warning. Even then it may not be used to
+go into any construct that requires initialization, such as a
+subroutine or a C<foreach> loop. It also can't be used to go into a
+construct that is optimized away,
+
The C<goto-&NAME> form is quite different from the other forms of
C<goto>. In fact, it isn't a goto in the normal sense at all, and
doesn't have the stigma associated with other gotos. Instead, it