diff options
-rw-r--r-- | pod/perldiag.pod | 29 | ||||
-rw-r--r-- | pp_ctl.c | 8 | ||||
-rwxr-xr-x | t/op/runlevel.t | 8 | ||||
-rw-r--r-- | t/pragma/warn/pp_ctl | 2 |
4 files changed, 25 insertions, 22 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 277e6342bc..deccf7c7d5 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -542,7 +542,7 @@ so it was truncated to the string shown. (F) A subroutine invoked from an external package via perl_call_sv() exited by calling exit. -=item Can't "goto" outside a block +=item Can't "goto" out of a pseudo block (F) A "goto" statement was executed to jump out of what might look like a block, except that it isn't a proper block. This usually @@ -554,22 +554,24 @@ is a no-no. See L<perlfunc/goto>. (F) A "goto" statement was executed to jump into the middle of a foreach loop. You can't get there from here. See L<perlfunc/goto>. -=item Can't "last" outside a block +=item Can't "last" outside a loop block (F) A "last" statement was executed to break out of the current block, except that there's this itty bitty problem called there isn't a current block. Note that an "if" or "else" block doesn't count as a -"loopish" block, as doesn't a block given to sort(). You can usually double -the curlies to get the same effect though, because the inner curlies -will be considered a block that loops once. See L<perlfunc/last>. +"loopish" block, as doesn't a block given to sort(), map() or grep(). +You can usually double the curlies to get the same effect though, +because the inner curlies will be considered a block that loops once. +See L<perlfunc/last>. -=item Can't "next" outside a block +=item Can't "next" outside a loop block (F) A "next" statement was executed to reiterate the current block, but there isn't a current block. Note that an "if" or "else" block doesn't -count as a "loopish" block, as doesn't a block given to sort(). You can -usually double the curlies to get the same effect though, because the inner -curlies will be considered a block that loops once. See L<perlfunc/next>. +count as a "loopish" block, as doesn't a block given to sort(), map() +or grep(). You can usually double the curlies to get the same effect +though, because the inner curlies will be considered a block that +loops once. See L<perlfunc/next>. =item Can't read CRTL environ @@ -578,13 +580,14 @@ from the CRTL's internal environment array and discovered the array was missing. You need to figure out where your CRTL misplaced its environ or define F<PERL_ENV_TABLES> (see L<perlvms>) so that environ is not searched. -=item Can't "redo" outside a block +=item Can't "redo" outside a loop block (F) A "redo" statement was executed to restart the current block, but there isn't a current block. Note that an "if" or "else" block doesn't -count as a "loopish" block, as doesn't a block given to sort(). You can -usually double the curlies to get the same effect though, because the inner -curlies will be considered a block that loops once. See L<perlfunc/redo>. +count as a "loopish" block, as doesn't a block given to sort(), map() +or grep(). You can usually double the curlies to get the same effect +though, because the inner curlies will be considered a block that +loops once. See L<perlfunc/redo>. =item Can't bless non-reference value @@ -1861,7 +1861,7 @@ PP(pp_last) if (PL_op->op_flags & OPf_SPECIAL) { cxix = dopoptoloop(cxstack_ix); if (cxix < 0) - DIE(aTHX_ "Can't \"last\" outside a block"); + DIE(aTHX_ "Can't \"last\" outside a loop block"); } else { cxix = dopoptolabel(cPVOP->op_pv); @@ -1939,7 +1939,7 @@ PP(pp_next) if (PL_op->op_flags & OPf_SPECIAL) { cxix = dopoptoloop(cxstack_ix); if (cxix < 0) - DIE(aTHX_ "Can't \"next\" outside a block"); + DIE(aTHX_ "Can't \"next\" outside a loop block"); } else { cxix = dopoptolabel(cPVOP->op_pv); @@ -1964,7 +1964,7 @@ PP(pp_redo) if (PL_op->op_flags & OPf_SPECIAL) { cxix = dopoptoloop(cxstack_ix); if (cxix < 0) - DIE(aTHX_ "Can't \"redo\" outside a block"); + DIE(aTHX_ "Can't \"redo\" outside a loop block"); } else { cxix = dopoptolabel(cPVOP->op_pv); @@ -2343,7 +2343,7 @@ PP(pp_goto) /* FALL THROUGH */ case CXt_FORMAT: case CXt_NULL: - DIE(aTHX_ "Can't \"goto\" outside a block"); + DIE(aTHX_ "Can't \"goto\" out of a pseudo block"); default: if (ix) DIE(aTHX_ "panic: goto"); diff --git a/t/op/runlevel.t b/t/op/runlevel.t index 08ad0a326a..1d923cf1b5 100755 --- a/t/op/runlevel.t +++ b/t/op/runlevel.t @@ -57,7 +57,7 @@ __END__ @a = sort { last ; } @a; } EXPECT -Can't "last" outside a block at - line 3. +Can't "last" outside a loop block at - line 3. ######## package TEST; @@ -174,7 +174,7 @@ exit; bar: print "bar reached\n"; EXPECT -Can't "goto" outside a block at - line 2. +Can't "goto" out of a pseudo block at - line 2. ######## sub sortfn { (split(/./, 'x'x10000))[0]; @@ -227,7 +227,7 @@ tie $bar, TEST; } print "OK\n"; EXPECT -Can't "next" outside a block at - line 8. +Can't "next" outside a loop block at - line 8. ######## package TEST; @@ -285,7 +285,7 @@ package main; tie $bar, TEST; } EXPECT -Can't "next" outside a block at - line 4. +Can't "next" outside a loop block at - line 4. ######## @a = (1, 2, 3); foo: diff --git a/t/pragma/warn/pp_ctl b/t/pragma/warn/pp_ctl index 70e6d60e8d..f61da1a8e1 100644 --- a/t/pragma/warn/pp_ctl +++ b/t/pragma/warn/pp_ctl @@ -126,7 +126,7 @@ no warnings 'unsafe' ; @b = sort { last } @a ; EXPECT Exiting pseudo-block via last at - line 4. -Can't "last" outside a block at - line 4. +Can't "last" outside a loop block at - line 4. ######## # pp_ctl.c use warnings 'unsafe' ; |