Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Exported subroutine redefine

by Somni (Friar)
on Nov 11, 2007 at 02:29 UTC ( #650110=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://650110]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2023-11-29 11:08 GMT
Find Nodes?
    Voting Booth?

    No recent polls found