Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sysread/filter-cleanup
A flat, stackable error handler for Perl.
https://github.com/sysread/filter-cleanup
Last synced: about 1 month ago
JSON representation
A flat, stackable error handler for Perl.
- Host: GitHub
- URL: https://github.com/sysread/filter-cleanup
- Owner: sysread
- Created: 2012-05-31T15:11:48.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T17:56:38.000Z (about 7 years ago)
- Last Synced: 2023-08-20T22:46:47.912Z (over 1 year ago)
- Language: Perl
- Size: 16.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.pod
- Changelog: Changes
Awesome Lists containing this project
README
=pod
=encoding UTF-8
=head1 NAME
Filter::Cleanup - Execute cleanup statements when scope closes, regardless of errors
=head1 VERSION
version 0.03
=head1 SYNOPSIS
use Filter::Cleanup;
open my $fh, $file_path or die $!;
cleanup { close $fh };
do_risky_stuff_with_fh($fh);=head1 DESCRIPTION
Defines a block of code to be evaluated once the current scope has completed
execution. If an error is thrown during the execution of statements after the
C block, the error is trapped and rethrown after the C block
is executed.=head1 NAME
Filter::Cleanup
=head1 CAVEATS
=head2 ORDERING OF CLEANUP BLOCKS
A cleanup block will execute ahead of any cleanups defined before it. That is,
for a given scope, cleanup blocks will be called in the opposite order in which
they were declared.=head2 IMPLEMENTATION
This module was originally implemented as a source filter (hence the name), but
now uses L.=head1 SEE ALSO
=head2 Guard
L is implemented in XS and attaches a code block to the actual stack
frame, ensuring it is executed regardless of how the scope was exited. In many
cases, this may be preferable to the behavior of C, which will
not be executed if the block calls C or C (note that C I
handled correctly).=head1 AUTHOR
Jeff Ober L
=head1 LICENSE
Perl5
=head1 AUTHOR
Jeff Ober
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2017 by Jeff Ober.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.=cut