On Friday, September 9, 2016 at 9:44:51 PM UTC-7, Aristotle Pagaltzis wrote:
>
> * Abelard <abelard...@gmail.com <javascript:>> [2016-09-09 17:48]: 
> > I think I need a way to modify the exception that 
> > Plack::Middleware::StackTrace sees in its DIE handler before it receives 
> > it... 
>
> Are you looking for something like this? 
>
>     my $old_die_handler = $SIG{__DIE__}; 
>     local $SIG{__DIE__} = sub { 
>         $_[0] .= " lots of details about system state"; 
>         ref $old_die_handler ? goto &$old_die_handler : die @_; 
>     }; 
>     dispatch();  # no eval{} 
>
> Regards, 
> -- 
> Aristotle Pagaltzis // <http://plasmasturm.org/> 
>

Yes! Exactly like that. Except for this:

  Modification of a read-only value attempted at ./try line 13.
 
Is there a way around that? Here's my test code on perl 18.2:

#!/usr/bin/env perl

use strict;
use warnings;

local $SIG{__DIE__} = sub {
  die "FOO! $_[0]";
};

my $old_die_handler = $SIG{__DIE__};
local $SIG{__DIE__} = sub {
  $_[0] .= " lots of details about system state";
  ref $old_die_handler ? goto &$old_die_handler : die @_;
};
die "in dispatch";

Thanks.

-- 

--- 
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 
to psgi-plack+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to