--- AnyEvent/lib/AnyEvent.pm 2009/07/08 01:11:12 1.228 +++ AnyEvent/lib/AnyEvent.pm 2009/07/08 13:46:46 1.231 @@ -178,9 +178,9 @@ You can create an I/O watcher by calling the C<< AnyEvent->io >> method with the following mandatory key-value pairs as arguments: -C is the Perl I (I file descriptor, see below) to -watch for events (AnyEvent might or might not keep a reference to this -file handle). Note that only file handles pointing to things for which +C is the Perl I (or a naked file descriptor) to watch +for events (AnyEvent might or might not keep a reference to this file +handle). Note that only file handles pointing to things for which non-blocking operation makes sense are allowed. This includes sockets, most character devices, pipes, fifos and so on, but not for example files or block devices. @@ -211,29 +211,6 @@ undef $w; }); -=head3 GETTING A FILE HANDLE FROM A FILE DESCRIPTOR - -It is not uncommon to only have a file descriptor, while AnyEvent requires -a Perl file handle. - -There are basically two methods to convert a file descriptor into a file handle. If you own -the file descriptor, you can open it with C<&=>, as in: - - open my $fh, "<&=$fileno" or die "xxx: ยง!"; - -This will "own" the file descriptor, meaning that when C<$fh> is -destroyed, it will automatically close the C<$fileno>. Also, note that -the open mode (read, write, read/write) must correspond with how the -underlying file descriptor was opened. - -In many cases, taking over the file descriptor is now what you want, in -which case the only alternative is to dup the file descriptor: - - open my $fh, "<&$fileno" or die "xxx: $!"; - -This has the advantage of not closing the file descriptor and the -disadvantage of making a slow copy. - =head2 TIME WATCHERS You can create a time watcher by calling the C<< AnyEvent->timer >> @@ -893,9 +870,9 @@ =head1 OTHER MODULES The following is a non-exhaustive list of additional modules that use -AnyEvent and can therefore be mixed easily with other AnyEvent modules -in the same program. Some of the modules come with AnyEvent, some are -available via CPAN. +AnyEvent as a client and can therefore be mixed easily with other AnyEvent +modules and other event loops in the same program. Some of the modules +come with AnyEvent, most are available via CPAN. =over 4 @@ -914,7 +891,7 @@ Provide read and write buffers, manages watchers for reads and writes, supports raw and formatted I/O, I/O queued and fully transparent and -non-blocking SSL/TLS. +non-blocking SSL/TLS (via L. =item L @@ -952,18 +929,19 @@ A non-blocking interface to gpsd, a daemon delivering GPS information. -=item L - -A non-blocking interface to the Internet Go Server protocol (used by -L). - =item L AnyEvent based IRC client module family (replacing the older Net::IRC3). -=item L +=item L + +AnyEvent based XMPP (Jabber protocol) module family (replacing the older +Net::XMPP2>. + +=item L -AnyEvent based XMPP (Jabber protocol) module family. +A non-blocking interface to the Internet Go Server protocol (used by +L). =item L @@ -978,10 +956,6 @@ Has special support for AnyEvent via L. -=item L - -The lambda approach to I/O - don't ask, look there. Can use AnyEvent. - =back =cut @@ -993,7 +967,7 @@ use Carp; -our $VERSION = 4.8; +our $VERSION = 4.801; our $MODEL; our $AUTOLOAD; @@ -1148,12 +1122,10 @@ my ($poll, $fh, $r, $w) = @_; # cygwin requires the fh mode to be matching, unix doesn't - my ($rw, $mode) = $poll eq "r" ? ($r, "<") - : $poll eq "w" ? ($w, ">") - : Carp::croak "AnyEvent->io requires poll set to either 'r' or 'w'"; + my ($rw, $mode) = $poll eq "r" ? ($r, "<") : ($w, ">"); - open my $fh2, "$mode&" . fileno $fh - or die "cannot dup() filehandle: $!,"; + open my $fh2, "$mode&", $fh + or die "AnyEvent->io: cannot dup() filehandle in mode '$poll': $!,"; # we assume CLOEXEC is already set by perl in all important cases @@ -2146,16 +2118,18 @@ Implementations: L, L, L, L, L, L, L, -L. +L, L. Non-blocking file handles, sockets, TCP clients and -servers: L, L. +servers: L, L, L. Asynchronous DNS: L. -Coroutine support: L, L, L, L, +Coroutine support: L, L, L, +L, -Nontrivial usage examples: L, L, L. +Nontrivial usage examples: L, L, +L. =head1 AUTHOR