Hi all,
I found myself wanting to check whether some code had a $SIG{__DIE__} in
it and realized I still had this silly module in my experiments
directory.
This throws an error whenever a $SIG{__DIE__} is assigned without a
local(). Potentially useful in tests, or just via -M...
(Yes, actually it throws an error when it gets deleted, but the point is
to catch itself getting replaced.)
That seems like it might be useful on CPAN and I'm not finding anything
in a search, so it just needs a name? I thought about adding more
features, but then that would just be feature creep.
Should it be in Devel::?
package Carp::NoSigDie;
use warnings; use strict; use Carp ();
use overload '&{}' => sub {sub {}}, fallback => 1;
$SIG{__DIE__} = bless({}, __PACKAGE__);
my $ended = 0; END {$ended = 1};
sub DESTROY { return if($ended); Carp::carp("bad bunny"); exit(1); }
1;
Thoughts?
Thanks,
Eric
--
A counterintuitive sansevieria trifasciata was once literalized
guiltily.
--Product of Artificial Intelligence
---------------------------------------------------
http://scratchcomputing.com
---------------------------------------------------