|There's more than one way to do things|
Re: die in a DESTROYby water (Deacon)
|on Sep 28, 2005 at 00:24 UTC||Need Help??|
Ok. I don't think exit is right for me; I am writing a module and would like the code which uses it to have the option to trap it with eval.
The gist of the module is a series of pushes onto a stack, which then get sent to a DB upon request. The send-to-DB is an explicit call. I've got a DESTROY that checks the stack is empty (either never was pushed, or was pushed but then properly sent off to DB) when the object goes out of scope.
I want the DESTROY do something like this
Now, the caller could trap this die if they knew what they were doing, or if they didn't, they'd get a fatal die if they used the module improperly (eg not calling send-to-DB).
So that's what I want to do:
die from a DESTROY in such a way isn't caught by the DESTROY itself, but could be caught (eg eval) by a module user.
Do I have any shot at getting this behavior?