1Syntax::Keyword::FinallUys(e3r)Contributed Perl DocumentSaytnitoanx::Keyword::Finally(3)
2
3
4
6 "Syntax::Keyword::Finally" - add "FINALLY" phaser block syntax to perl
7
9 See instead Syntax::Keyword::Defer.
10
11 use Syntax::Keyword::Defer;
12
13 {
14 my $dbh = DBI->connect( ... ) or die "Cannot connect";
15 defer { $dbh->disconnect; }
16
17 my $sth = $dbh->prepare( ... ) or die "Cannot prepare";
18 defer { $sth->finish; }
19
20 ...
21 }
22
24 This module provides a syntax plugin that implements a phaser block
25 that executes its block when the containing scope has finished. The
26 syntax of the "FINALLY" block looks similar to other phasers in perl
27 (such as "BEGIN"), but the semantics of its execution are different.
28
29 The keyword has now been renamed to "defer" but is otherwise identical
30 to the syntax and semantics that were provided here. This module
31 currently provides a back-compatibility layer.
32
33 This will be removed in a later version. You should change any code
34 currently using it, to Syntax::Keyword::Defer instead.
35
37 Paul Evans <leonerd@leonerd.org.uk>
38
39
40
41perl v5.36.0 2022-07-22 Syntax::Keyword::Finally(3)