summaryrefslogtreecommitdiff
path: root/pod
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <leonerd@leonerd.org.uk>2023-03-07 13:50:14 +0000
committerPaul Evans <leonerd@leonerd.org.uk>2023-03-07 16:08:27 +0000
commitc61be20d6b8dbbeaee296619b71e85b455688542 (patch)
treedb11532b75ca03d2c858ede6c3a24daf55c52c04 /pod
parent3c1759e470b2636903c76b2d75c47cfe28f5e017 (diff)
downloadperl-c61be20d6b8dbbeaee296619b71e85b455688542.tar.gz
Add perldelta.pod entry for goto being permitted in some defer/finally blocks
Diffstat (limited to 'pod')
-rw-r--r--pod/perldelta.pod16
1 files changed, 16 insertions, 0 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index cad4e405ce..ce1a2adec5 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -27,6 +27,22 @@ here, but most should go in the L</Performance Enhancements> section.
[ List each enhancement as a =head2 entry ]
+=head2 Some C<goto>s are now permitted in C<defer> and C<finally> blocks
+
+Perl version 5.36.0 added C<defer> blocks and permitted the C<finally> keyword
+to also add similar behaviour to C<try>/C<catch> syntax. These did not permit
+any C<goto> expression within the body, as it could have caused control flow
+to jump out of the block. Now, some C<goto> expressions are allowed, if they
+have a constant target label, and that label is found within the block.
+
+ use feature 'defer';
+
+ defer {
+ goto LABEL;
+ print "This does not execute\n";
+ LABEL: print "This does\n";
+ }
+
=head1 Security
XXX Any security-related notices go here. In particular, any security