--- AnyEvent/lib/AnyEvent.pm 2008/05/25 23:52:02 1.136 +++ AnyEvent/lib/AnyEvent.pm 2008/05/31 13:38:01 1.151 @@ -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 @@ -50,7 +56,7 @@ AnyEvent is different: AnyEvent + POE works fine. AnyEvent + Glib works fine. AnyEvent + Tk works fine etc. etc. but none of these work together -with the rest: POE + IO::Async? no go. Tk + Event? no go. Again: if +with the rest: POE + IO::Async? No go. Tk + Event? No go. Again: if your module uses one of those, every user of your module has to use it, too. But if your module uses AnyEvent, it works transparently with all event models it supports (including stuff like POE and IO::Async, as long @@ -64,7 +70,13 @@ offering the functionality that is necessary, in as thin as a wrapper as technically possible. -Of course, if you want lots of policy (this can arguably be somewhat +Of course, AnyEvent comes with a big (and fully optional!) toolbox +of useful functionality, such as an asynchronous DNS resolver, 100% +non-blocking connects (even with TLS/SSL, IPv6 and on broken platforms +such as Windows) and lots of real-world knowledge and workarounds for +platform bugs and differences. + +Now, if you I lots of policy (this can arguably be somewhat useful) and you want to force your users to use the one and only event model, you should I use this module. @@ -104,7 +116,7 @@ The pure-perl implementation of AnyEvent is called C. Like other event modules you can load it -explicitly. +explicitly and enjoy the high availability of that event loop :) =head1 WATCHERS @@ -128,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 @@ -229,6 +241,69 @@ AnyEvent always prefers relative timers, if available, matching the AnyEvent API. +AnyEvent has two additional methods that return the "current time": + +=over 4 + +=item AnyEvent->time + +This returns the "current wallclock time" as a fractional number of +seconds since the Epoch (the same thing as C