--- AnyEvent/lib/AnyEvent.pm 2008/05/11 17:54:13 1.117 +++ AnyEvent/lib/AnyEvent.pm 2008/05/23 22:52:31 1.124 @@ -1,4 +1,4 @@ -=head1 NAME +=head1 => NAME AnyEvent - provide framework for multiple event loops @@ -693,7 +693,7 @@ use Carp; -our $VERSION = '3.41'; +our $VERSION = '3.6'; our $MODEL; our $AUTOLOAD; @@ -732,12 +732,12 @@ push @post_detect, $cb; defined wantarray - ? bless \$cb, "AnyEvent::Util::Guard" + ? bless \$cb, "AnyEvent::Util::PostDetect" : () } } -sub AnyEvent::Util::Guard::DESTROY { +sub AnyEvent::Util::PostDetect::DESTROY { @post_detect = grep $_ != ${$_[0]}, @post_detect; } @@ -813,7 +813,7 @@ # default implementation for ->condvar sub condvar { - bless {}, AnyEvent::CondVar:: + bless { @_ == 3 ? (_ae_cb => $_[2]) : () }, AnyEvent::CondVar:: } # default implementation for ->signal @@ -946,7 +946,7 @@ sub end { return if --$_[0]{_ae_counter}; - &{ $_[0]{_ae_end_cb} } if $_[0]{_ae_end_cb}; + &{ $_[0]{_ae_end_cb} || sub { $_[0]->send } }; } # undocumented/compatibility with pre-3.4 @@ -1050,7 +1050,7 @@ warn "io event <$_[0]>\n"; # will always output chomp (my $input = ); # read a line warn "read: $input\n"; # output what has been read - $cv->broadcast if $input =~ /^q/i; # quit program if /^q/i + $cv->send if $input =~ /^q/i; # quit program if /^q/i }, ); @@ -1065,7 +1065,7 @@ new_timer; # create first timer - $cv->wait; # wait until user enters /^q/i + $cv->recv; # wait until user enters /^q/i =head1 REAL-WORLD EXAMPLE @@ -1131,7 +1131,7 @@ if (end-of-file or data complete) { $txn->{result} = $txn->{buf}; - $txn->{finished}->broadcast; + $txn->{finished}->send; $txb->{cb}->($txn) of $txn->{cb}; # also call callback } @@ -1139,7 +1139,7 @@ request was already finished, it doesn't wait, of course, and returns the data: - $txn->{finished}->wait; + $txn->{finished}->recv; return $txn->{result}; The actual code goes further and collects all errors (Cs, exceptions) @@ -1184,10 +1184,10 @@ $fcp->txn_client_get ($url)->cb (sub { ... - $quit->broadcast; + $quit->send; }); - $quit->wait; + $quit->recv; =head1 BENCHMARKS @@ -1226,7 +1226,7 @@ I is the time, in microseconds, used to invoke a simple callback. The callback simply counts down a Perl variable and after it was -invoked "watcher" times, it would C<< ->broadcast >> a condvar once to +invoked "watcher" times, it would C<< ->send >> a condvar once to signal the end of this phase. I is the time, in microseconds, that it takes to destroy a single @@ -1497,6 +1497,8 @@ L, L, L. +Asynchronous DNS: L. + Coroutine support: L, L, L, L, Nontrivial usage examples: L, L.