On Sat, Nov 17, 2001 at 11:33:25AM -0500, Matt Cashner wrote: > > i have implemented a very simple exception handling mechanism for POE as > a proof of concept. Its a very small subclass of Session which wraps > state invocation with an eval. if $@, we fire off SIGDIE with the > contents of $@ as ARG1. Note: this requires bleadpoe from CVS directly > and very very current copy of bleadpoe at that.
[...] There was some discussion about wrapping $poe_kernel->run() in eval. A lot of housekeeping goes on after an event is dispatched. Catching die() outside run() will bypass it, leaving POE in an inconsistent state. I'm fairly certain that the block eval will need to be down in the event dispatcher. It may need to be in Session if they do any housekeeping after invoking handlers. Please speak up if there's a better way. If you have more than a casual interest in this project, please take a look at http://eekeek.org/perl/excep.tar.gz That's Matt's code with some changes. It's a tidy exception mechanism, and it was very easy to extend. * It handles double-fault (die within a SIGDIE handler). * It handles die() in someone else's library code. * It handles uncaught SIGDIE in a graceful way. * It proves that POE::Session and POE::Kernel may be subclassed. * It has two test / proof of concept programs. Notes about the CVS version of POE: * It's required. * Anonymous CVS instructions are at the bottom of http://poe.perl.org/?Where_to_Get_POE * The CVS version does not need to be installed. * Point C<perl -I>, PERL5LIB, or C<use lib qw(...)> at it and go. Notes about excep.tar.gz: * The tarball will explode into a subdirectory. * The test programs can run where they're unpacked. * No patching or installing is needed. It does all its magic through subclasses, thanks to Matt. Thanks for reading. -- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sourceforge.net
