in reply to Changing the return number for "die"
There's no direct way, but there's a kludge:
in an END block you can change the exit code by
changing $?. Thus, you can do this:
$EXIT = ~0 END { $? and $? = $EXIT; } sub xdie { $EXIT = shift; die @_; } xdie 16, "argh";
Update: See the other reply for a simpler way:
sub xdie { $! = shift; die $@; } xdie 16, "argh";
|
|---|