Files
ports/devel/p5-Syntax-Keyword-Defer/pkg-descr
T
2026-10-04 04:07:15 +00:00

15 lines
390 B
Plaintext

This module provides a syntax plugin that implements a block which executes
when the containing scope has finished.
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; }
...
}