-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent behaviour of continue inside given inside while #15763
Comments
From russ.herman@gmail.comThis is a bug report for perl from russ.herman@gmail.com, # This file demonstrates inconsistent behaviour with the use of continue # use strict; $in = "a.,.,.,b"; exit; sub xform ($$) { $_ = $fields0; while (1) { RESULT 1 a.,.,.,b 1 a...,,,b 1 a...,,,b 1 a,,,...b 1 a,,,...b Flags: Site configuration information for perl 5.24.0: Configured by russ at Sun Dec 11 12:49:47 EST 2016. Summary of my perl5 (revision 5 version 24 subversion 0) configuration: Platform: @INC for perl 5.24.0: Environment for perl 5.24.0: |
From zefram@fysh.orgruss wrote:
There is an intentional difference, in that your "goto" target isn't -zefram |
The RT System itself - Status changed from 'new' to 'open' |
From russ.herman@gmail.comZefram - Thanks for clarification. I was assuming that *continue* would behave as Russ |
From @jkeenanOn Mon, 19 Dec 2016 00:35:33 GMT, russ.herman@gmail.com wrote:
Please review the patch attached. Thank you very much. -- |
From @jkeenan0001-Clarify-use-of-continue-keyword-after-given.patchFrom 88dfff25bdfb63568e55eebc60c4758c9611bc1d Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Tue, 20 Dec 2016 18:27:36 -0500
Subject: [PATCH] Clarify use of 'continue' keyword after 'given'.
For: RT #130324
---
pod/perlsyn.pod | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod
index a5e075d..a78c095 100644
--- a/pod/perlsyn.pod
+++ b/pod/perlsyn.pod
@@ -638,8 +638,8 @@ Starting from Perl 5.16, one can prefix the switch
keywords with C<CORE::> to access the feature without a C<use feature>
statement. The keywords C<given> and
C<when> are analogous to C<switch> and
-C<case> in other languages, so the code in the previous section could be
-rewritten as
+C<case> in other languages -- though C<continue> is not -- so the code
+in the previous section could be rewritten as
use v5.10.1;
for ($var) {
@@ -1118,7 +1118,7 @@ a C<break>.
=head3 Fall-through
You can use the C<continue> keyword to fall through from one
-case to the next:
+case to the next immediate C<when> or C<default>:
given($foo) {
when (/x/) { say '$foo contains an x'; continue }
--
2.7.4
|
From @davidnicolOn Tue, Dec 20, 2016 at 5:30 PM, James E Keenan via RT
FWIW this looks perfect to me -- the root cause of the confusion has -- |
From @jkeenanOn Wed, 21 Dec 2016 20:38:24 GMT, davidnicol@gmail.com wrote:
I'll apply this to blead in a few days unless there are strong objections. Thank you very much. -- |
From russ.herman@gmail.comLooks good here. Thanks all. Russ On 16-12-21 08:46 PM, James E Keenan via RT wrote:
|
From @jkeenanOn Thu, 22 Dec 2016 01:46:29 GMT, jkeenan wrote:
Pushed to blead in commit c9e7382; resolving ticket. |
@jkeenan - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#130324 (status was 'resolved')
Searchable as RT130324$
The text was updated successfully, but these errors were encountered: