NAME No::Die


    use No::Die;
        or warn "It tried to die with msg: $DIE\n";


Only let modules die when you say it's OK.


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.


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.


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.


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.


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.


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.


Jos Boumans


This module is copyright (c) 2003 Jos Boumans <>. All rights reserved.

This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.