--- AnyEvent/lib/AnyEvent.pm 2008/05/10 00:57:31 1.110 +++ AnyEvent/lib/AnyEvent.pm 2008/05/10 20:30:35 1.113 @@ -551,15 +551,16 @@ have created an AnyEvent watcher anyway, that is, as late as possible at runtime. -=item $guard = AnyEvent::on_detect { BLOCK } +=item $guard = AnyEvent::post_detect { BLOCK } Arranges for the code block to be executed as soon as the event model is autodetected (or immediately if this has already happened). If called in scalar or list context, then it creates and returns an object -that automatically removes the callback again when it is destroyed. +that automatically removes the callback again when it is destroyed. See +L for a case where this is useful. -=item @AnyEvent::on_detect +=item @AnyEvent::post_detect If there are any code references in this array (you can C to it before or after loading AnyEvent), then they will called directly after @@ -569,7 +570,7 @@ if it contains a true value then the event loop has already been detected, and the array will be ignored. -Best use C instead. +Best use C instead. =back @@ -632,10 +633,6 @@ Provide read and write buffers and manages watchers for reads and writes. -=item L - -Provides a means to do non-blocking connects, accepts etc. - =item L Provides a simple web application server framework. @@ -670,19 +667,20 @@ Has special support for AnyEvent via L. -=item L +=item L, L -The lambda approach to I/O - don't ask, look there. Can use AnyEvent. +Truly asynchronous I/O, should be in the toolbox of every event +programmer. AnyEvent::AIO transparently fuses IO::AIO and AnyEvent +together. -=item L +=item L, L -Truly asynchronous I/O, should be in the toolbox of every event -programmer. Can be trivially made to use AnyEvent. +Truly asynchronous Berkeley DB access. AnyEvent::AIO transparently fuses +IO::AIO and AnyEvent together. -=item L +=item L -Truly asynchronous Berkeley DB access. Can be trivially made to use -AnyEvent. +The lambda approach to I/O - don't ask, look there. Can use AnyEvent. =back @@ -721,9 +719,9 @@ our %method = map +($_ => 1), qw(io timer signal child condvar one_event DESTROY); -our @on_detect; +our @post_detect; -sub on_detect(&) { +sub post_detect(&) { my ($cb) = @_; if ($MODEL) { @@ -731,7 +729,7 @@ 1 } else { - push @on_detect, $cb; + push @post_detect, $cb; defined wantarray ? bless \$cb, "AnyEvent::Util::Guard" @@ -740,7 +738,7 @@ } sub AnyEvent::Util::Guard::DESTROY { - @on_detect = grep $_ != ${$_[0]}, @on_detect; + @post_detect = grep $_ != ${$_[0]}, @post_detect; } sub detect() { @@ -792,7 +790,7 @@ unshift @ISA, $MODEL; push @{"$MODEL\::ISA"}, "AnyEvent::Base"; - (shift @on_detect)->() while @on_detect; + (shift @post_detect)->() while @post_detect; } $MODEL