--- AnyEvent/lib/AnyEvent.pm 2008/09/04 10:58:58 1.179 +++ AnyEvent/lib/AnyEvent.pm 2008/09/06 07:00:45 1.180 @@ -852,7 +852,7 @@ package AnyEvent; no warnings; -use strict; +use strict qw(vars subs); use Carp; @@ -1177,52 +1177,28 @@ *broadcast = \&send; *wait = \&_wait; -=head1 SUPPLYING YOUR OWN EVENT MODEL INTERFACE - -This is an advanced topic that you do not normally need to use AnyEvent in -a module. This section is only of use to event loop authors who want to -provide AnyEvent compatibility. - -If you need to support another event library which isn't directly -supported by AnyEvent, you can supply your own interface to it by -pushing, before the first watcher gets created, the package name of -the event module and the package name of the interface to use onto -C<@AnyEvent::REGISTRY>. You can do that before and even without loading -AnyEvent, so it is reasonably cheap. - -Example: - - push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; - -This tells AnyEvent to (literally) use the C -package/class when it finds the C package/module is already loaded. - -When AnyEvent is loaded and asked to find a suitable event model, it -will first check for the presence of urxvt by trying to C the -C module. +=head1 ERROR AND EXCEPTION HANDLING -The class should provide implementations for all watcher types. See -L (source code), L (Source code) -and so on for actual examples. Use C to -see the sources. - -If you don't provide C and C watchers than AnyEvent will -provide suitable (hopefully) replacements. - -The above example isn't fictitious, the I (a.k.a. urxvt) -terminal emulator uses the above line as-is. An interface isn't included -in AnyEvent because it doesn't make sense outside the embedded interpreter -inside I, and it is updated and maintained as part of the -I distribution. - -I also cheats a bit by not providing blocking access to -condition variables: code blocking while waiting for a condition will -C. This still works with most modules/usages, and blocking calls must -not be done in an interactive application, so it makes sense. +In general, AnyEvent does not do any error handling - it relies on the +caller to do that if required. The L module (see also +the C environment variable, below) provides strict +checking of all AnyEvent methods, however, which is highly useful during +development. + +As for exception handling (i.e. runtime errors and exceptions thrown while +executing a callback), this is not only highly event-loop specific, but +also not in any way wrapped by this module, as this is the job of the main +program. + +The pure perl event loop simply re-throws the exception (usually +within C<< condvar->recv >>), the L and L modules call C<< +$Event/EV::DIED->() >>, L uses C<< install_exception_handler >> and +so on. =head1 ENVIRONMENT VARIABLES -The following environment variables are used by this module: +The following environment variables are used by this module or its +submodules: =over 4 @@ -1249,8 +1225,9 @@ In other words, enables "strict" mode. -Unlike C it is definitely recommended ot keep it off in -production. +Unlike C, it is definitely recommended ot keep it off in +production. Keeping C in your environment while +developing programs can be very useful, however. =item C @@ -1306,6 +1283,49 @@ =back +=head1 SUPPLYING YOUR OWN EVENT MODEL INTERFACE + +This is an advanced topic that you do not normally need to use AnyEvent in +a module. This section is only of use to event loop authors who want to +provide AnyEvent compatibility. + +If you need to support another event library which isn't directly +supported by AnyEvent, you can supply your own interface to it by +pushing, before the first watcher gets created, the package name of +the event module and the package name of the interface to use onto +C<@AnyEvent::REGISTRY>. You can do that before and even without loading +AnyEvent, so it is reasonably cheap. + +Example: + + push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; + +This tells AnyEvent to (literally) use the C +package/class when it finds the C package/module is already loaded. + +When AnyEvent is loaded and asked to find a suitable event model, it +will first check for the presence of urxvt by trying to C the +C module. + +The class should provide implementations for all watcher types. See +L (source code), L (Source code) +and so on for actual examples. Use C to +see the sources. + +If you don't provide C and C watchers than AnyEvent will +provide suitable (hopefully) replacements. + +The above example isn't fictitious, the I (a.k.a. urxvt) +terminal emulator uses the above line as-is. An interface isn't included +in AnyEvent because it doesn't make sense outside the embedded interpreter +inside I, and it is updated and maintained as part of the +I distribution. + +I also cheats a bit by not providing blocking access to +condition variables: code blocking while waiting for a condition will +C. This still works with most modules/usages, and blocking calls must +not be done in an interactive application, so it makes sense. + =head1 EXAMPLE PROGRAM The following program uses an I/O watcher to read data from STDIN, a timer