This seems to work. 

use strict;
use warnings;

my $app = sub {
  my $old_die_handler = $SIG{__DIE__};

  local $SIG{__DIE__} = sub {
    # warn "my die called from ", caller, "\n";

    my $msg = shift;
    unshift @_, $msg . " lots of details about system state";

    die @_ unless $old_die_handler;

    $SIG{__DIE__} = $old_die_handler;
    goto &$old_die_handler;

  die "goodbye world!";
  # return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World' ] ];

The difference being that before we call the original die handler, we 
reassign SIG{__DIE__} back to it, which I guess re-enables the recursive 
call protection.
Does that seem okay to do?


You received this message because you are subscribed to the Google Groups 
"psgi-plack" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
For more options, visit

Reply via email to