best way to design user-defined hook system (handling async errors)

Lee Aylward laylward at gmail.com
Sun Jan 27 20:45:58 CET 2013


On Jan 27, 2013, at 8:40 AM, Marc Lehmann <schmorp at schmorp.de> wrote:
> 
> If you are concerned about your callback calling die without being able to
> prevent it, then indeed, you need to use eval.
> 
> For this case, you could create a wrapper that does what is needed, e.g.
> 
>   AE::timer 5, 0, mysub { ... } $error_cb;
> 
> Or whatever is appropriate.

Yes, this is my main concern. If the callback dies (as in https://gist.github.com/4645022) before calling the passed in function, an HTTP request will never complete. I see your point about wrapping async operations like AE::timer, I think that is the way I'll handle things.

Thanks much,
-- 
Lee


More information about the anyevent mailing list