NAME No::Die
SYNOPSIS
use No::Die;
Some::Function::that_dies()
or warn "It tried to die with msg: $DIE\n";
DESCRIPTION
Only let modules die when you say it's OK.
EXPLENATION
Tired of using eval as a straightjacket on modules that have as much interest in life as chronically depressed lemmings? Now there's a 24 hour suicide watch in No::Die. Only modules you permit to die may - the rest will just have to live with it. Their distress wil be noted in an error variable and undef will be returned. The ultimate decision of life and death will be left to your application.
USAGE
use [ packages => \@pkgs, files => \@files ]
By default, only die calls that are issued from the same package and the same file that the call to use No::Die
was in, will be actually allowed to be executed.
You can override this by supplying extra file- and/or packagenames that may also call die and have their request honoured.
$DIE
All functions that call die()
and are not allowed to, will have undef returned to them. The error they attempted to throw will be stored in an exported variable called $DIE
.
DIAGNOSTICS
When running under warnings, No::Die
will issue a warning for all unauthorized calls to die()
so you may inspect which unruly module is attempting to take it's own life in your program.
CAVEATS
Some modules do not conceive the possibillity that a die might not be honoured and do not explicitly end their subroutine, but do something like this:
sub foo {
...
die 'oops' if $condition;
# go on with stuff
...
}
The execution after the call to die will now happen, since the module in question wasn't allowed to call die()
to begin with.
NOTES
Apparently some people forget this: Carp::croak and Carp::confess also use die()
under the hood, so they'll be affected as well by the use of No::Die.
AUTHOR
Jos Boumans kane@cpan.org
COPYRIGHT
This module is copyright (c) 2003 Jos Boumans <kane@cpan.org>. All rights reserved.
This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.