++ed by:
2 non-PAUSE users
Author image Paul Evans


Syntax::Keyword::Finally - add FINALLY phaser block syntax to perl


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.

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.

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>