Hi Marc,
I'm a big fan of AnyEvent, and have built a small web-scraping framework with
it (http://noembed.com). 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.
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:
https://gist.github.com/4645022
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.
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.
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.
Thanks for any insights!
--
Lee Aylward_______________________________________________
anyevent mailing list
[email protected]
http://lists.schmorp.de/mailman/listinfo/anyevent