Sig::PackageScoped - Make $SIG{__DIE__} and $SIG{__WARN__} package scoped
use Sig::PackageScoped qw(set_sig unset_sig); set_sig( __DIE__ => sub { die "Really dead: @_" } ); unset_sig( __DIE__ => 1 );
If all your modules use this module's functions to declare their signal handlers, then they won't overwrite each other. If you're working with modules that don't play nice, see Sig::PackageScoped::Paranoid. But really, this is more of a demonstration of weird things you can do with Perl than a good thing to use in production. You have been warned.
This module will optionally export the set_sig and <unset_sig> subroutines. By default, nothing is exported.
set_sig
This module provides the following functions:
This function accepts a hash of options. The keys can be either __DIE__ or __WARN__, and the values should be coderefs to handle the specified pseudo-signal.
__DIE__
__WARN__
This function also expects a hash. The keys should be the pseudo-signal to unset, and the value can be any true value.
Dave Rolsky <autarch@urth.org>
Please report any bugs or feature requests to bug-sig-packagescoped@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-sig-packagescoped@rt.cpan.org
Copyright 2001-2007 David Rolsky, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sig::PackageScoped, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sig::PackageScoped
CPAN shell
perl -MCPAN -e shell install Sig::PackageScoped
For more information on module installation, please visit the detailed CPAN module installation guide.