Syntax::Keyword::Finally - add FINALLY phaser block syntax to perl
Syntax::Keyword::Finally
FINALLY
See instead Syntax::Keyword::Defer.
use Syntax::Keyword::Defer; { my $dbh = DBI->connect( ... ) or die "Cannot connect"; defer { $dbh->disconnect; } my $sth = $dbh->prepare( ... ) or die "Cannot prepare"; defer { $sth->finish; } ... }
This module provides a syntax plugin that implements a phaser block that executes its block when the containing scope has finished. The syntax of the FINALLY block looks similar to other phasers in perl (such as BEGIN), but the semantics of its execution are different.
BEGIN
The keyword has now been renamed to defer but is otherwise identical to the syntax and semantics that were provided here. This module currently provides a back-compatibility layer.
defer
This will be removed in a later version. You should change any code currently using it, to Syntax::Keyword::Defer instead.
Paul Evans <leonerd@leonerd.org.uk>
To install Syntax::Keyword::Defer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Syntax::Keyword::Defer
CPAN shell
perl -MCPAN -e shell install Syntax::Keyword::Defer
For more information on module installation, please visit the detailed CPAN module installation guide.