summaryrefslogtreecommitdiff
path: root/devel/p5-Syntax-Keyword-Defer/pkg-descr
blob: 536bda5936f142634b3ace0956e6d67e001ad551 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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; }

          ...
       }