Object-InsideOut - Problematic use of signal __DIE__ handlers in OIO internals

Posted on Fri Sep 12 17:20:13 2008 by flories
Problematic use of signal __DIE__ handlers in OIO internals
The OIO internal $SIG{__DIE__} approach, heavily used to provide proper debugging info, unfortunately seems to interfere with custom exception mechanisms, at least in occasions that have to do with object initializations. Example:
sub custom_throw { die "I'd like to throw some perl error as is, rather than one with OIO debug-info clutter: $@"; } A->new(); package A; use Object::InsideOut;{ sub _init :Init { eval { B::foo(); }; main::custom_throw() if $@; } } 1; package B; use Carp qw(croak); sub foo { croak "Threw an error for fun" };
In all, OIO is great work that fascilitates good work, but I would be glad if you find a better solution on that issue. In the meantime, one has to work-around with another "local $SIG{__DIE__};" within evals in :Init & Co. subroutines. At last, it is an ugly hack to cope with a foreign problem. Thank you, flories
Direct Responses: 8797 | Write a response