Protect-Unwind - Safe cleanup blocks, Common Lisp style
use Protect::Unwind; protect { goto ESCAPE; } unwind { print "This is printed no matter what happens in protect."; }; ESCAPE:
This module is just syntactic sugar around Guard. It implements an interface like Common Lisp's unwind-protect.
It only exists so that hopefully lisp programmers new to perl will find this module before they find the buggy Unwind::Protect.
Note that if your unwind forms throw exceptions the behaviour is somewhat complicated (see the Guard docs).
Guard is a correct and efficient perl unwind-protect implementation which is why this module uses it.
unwind-protect
Doug Hoyte, <doug@hcsw.org>
<doug@hcsw.org>
Copyright 2012 Doug Hoyte.
This module is licensed under the same terms as perl itself.
To install Protect::Unwind, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Protect::Unwind
CPAN shell
perl -MCPAN -e shell install Protect::Unwind
For more information on module installation, please visit the detailed CPAN module installation guide.