<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Marc,<div><br></div><div>I'm a big fan of AnyEvent, and have built a small web-scraping framework with it (<a href="http://noembed.com">http://noembed.com</a>). Much of the app is defined as separate components that work as plugins; registering URL patterns that they can handle. If a component matches, it is run with a callback to call when complete.</div><div><br></div><div>The problem with this design is that there is very little that can be done if a component dies inside of one of it's own asynchronous callbacks (e.g. AE::HTTP, AE::timer). Here is an example of the problem I'm running into:</div><div><br></div><div><a href="https://gist.github.com/4645022">https://gist.github.com/4645022</a></div><div><br></div><div>I realize this could be somewhat mitigated by passing in a Condvar and requiring the component to catch any errors and then call $cv->croak.</div><div><br></div><div>Is there *any* way to handle errors like the one linked above, without requiring the hook to eval everything, and use a Condvar? I'd really like to keep the hook definitions as simple as possible, requiring no knowledge of the internals of the app.</div><div><br></div><div>I took a brief look at doing "local $SIG{__DIE__} = sub { $cv->send };" before calling the hook, but it appears that the local die handler is no longer defined when the hook's timer callback is called.</div><div><br></div><div>Thanks for any insights!</div><div>-- </div><div>Lee Aylward</div></body></html>