--- AnyEvent/lib/AnyEvent.pm 2008/05/30 21:43:26 1.147 +++ AnyEvent/lib/AnyEvent.pm 2008/06/06 15:35:30 1.158 @@ -1,4 +1,4 @@ -=head1 => NAME +=head1 NAME AnyEvent - provide framework for multiple event loops @@ -20,6 +20,12 @@ $w->send; # wake up current and all future recv's $w->recv; # enters "main loop" till $condvar gets ->send +=head1 INTRODUCTION/TUTORIAL + +This manpage is mainly a reference manual. If you are interested +in a tutorial or some gentle introduction, have a look at the +L manpage. + =head1 WHY YOU SHOULD USE THIS MODULE (OR NOT) Glib, POE, IO::Async, Event... CPAN offers event models by the dozen @@ -134,10 +140,10 @@ An any way to achieve that is this pattern: - my $w; $w = AnyEvent->type (arg => value ..., cb => sub { - # you can use $w here, for example to undef it - undef $w; - }); + my $w; $w = AnyEvent->type (arg => value ..., cb => sub { + # you can use $w here, for example to undef it + undef $w; + }); Note that C combination. This is necessary because in Perl, my variables are only visible after the statement in which they are @@ -348,21 +354,21 @@ Example: fork a process and wait for it - my $done = AnyEvent->condvar; - - my $pid = fork or exit 5; - - my $w = AnyEvent->child ( - pid => $pid, - cb => sub { - my ($pid, $status) = @_; - warn "pid $pid exited with status $status"; - $done->send; - }, - ); - - # do something else, then wait for process exit - $done->recv; + my $done = AnyEvent->condvar; + + my $pid = fork or exit 5; + + my $w = AnyEvent->child ( + pid => $pid, + cb => sub { + my ($pid, $status) = @_; + warn "pid $pid exited with status $status"; + $done->send; + }, + ); + + # do something else, then wait for process exit + $done->recv; =head2 CONDITION VARIABLES @@ -593,8 +599,9 @@ replaces it before doing so. The callback will be called when the condition becomes "true", i.e. when -C or C are called. Calling C inside the callback -or at any later time is guaranteed not to block. +C or C are called, with the only argument being the condition +variable itself. Calling C inside the callback or at any later time +is guaranteed not to block. =back @@ -747,6 +754,11 @@ Provides rich asynchronous DNS resolver capabilities. +=item L + +A simple-to-use HTTP library that is capable of making a lot of concurrent +HTTP requests. + =item L Provides a simple web application server framework. @@ -802,7 +814,7 @@ use Carp; -our $VERSION = 4.11; +our $VERSION = 4.151; our $MODEL; our $AUTOLOAD; @@ -1168,7 +1180,7 @@ For example, to force the pure perl model (L) you could start your program like this: - PERL_ANYEVENT_MODEL=Perl perl ... + PERL_ANYEVENT_MODEL=Perl perl ... =item C @@ -1653,15 +1665,24 @@ You can make AnyEvent completely ignore this variable by deleting it before the first watcher gets created, e.g. with a C block: - BEGIN { delete $ENV{PERL_ANYEVENT_MODEL} } - - use AnyEvent; + BEGIN { delete $ENV{PERL_ANYEVENT_MODEL} } + + use AnyEvent; Similar considerations apply to $ENV{PERL_ANYEVENT_VERBOSE}, as that can be used to probe what backend is used and gain other information (which is probably even less useful to an attacker than PERL_ANYEVENT_MODEL). +=head1 BUGS + +Perl 5.8 has numerous memleaks that sometimes hit this module and are hard +to work around. If you suffer from memleaks, first upgrade to Perl 5.10 +and check wether the leaks still show up. (Perl 5.10.0 has other annoying +mamleaks, such as leaking on C and C but it is usually not as +pronounced). + + =head1 SEE ALSO Utility functions: L. @@ -1686,8 +1707,8 @@ =head1 AUTHOR - Marc Lehmann - http://home.schmorp.de/ + Marc Lehmann + http://home.schmorp.de/ =cut