in reply to Re^2: Exported subroutine redefine
in thread Exported subroutine redefine

Strange, why aren't you just setting up your own $SIG{__DIE__} handler? It seems tailor-made to solve your problem for you. Granted, it's a hack, and can get messy, but it's a far better hack than trying to overload another module's subroutines globally.

A long time back I went down this road, as well. I thought it was a great idea to setup a __DIE__ handler and catch all the errors, turning them into pretty output for a web framework I was designing. I suppose it worked, sorta. It's much cleaner to design an actual exception model, with exception classes thrown by code, and possibly a catch routine that can transform string exceptions into a relevant object.

If the object in $@ has stringification it shouldn't break anything that's attempting to match against it. The only thing it should "break" is something that's checking to see if it's an object, in which case that code should know what it's doing.

Replies are listed 'Best First'.
Re^4: Exported subroutine redefine
by ribasushi (Pilgrim) on Nov 11, 2007 at 12:20 UTC
    Because $SIG{__DIE__} is too often used by other packages as well. I think my final solution is cleaner in regards to what I want to do.