Plack-App-MCCS
view release on metacpan or search on metacpan
local/lib/perl5/x86_64-linux-thread-multi/AnyEvent/Handle.pm view on Meta::CPAN
=head1 NAME
AnyEvent::Handle - non-blocking I/O on streaming handles via AnyEvent
=head1 SYNOPSIS
use AnyEvent;
use AnyEvent::Handle;
my $cv = AnyEvent->condvar;
my $hdl; $hdl = new AnyEvent::Handle
fh => \*STDIN,
on_error => sub {
my ($hdl, $fatal, $msg) = @_;
AE::log error => $msg;
$hdl->destroy;
$cv->send;
};
# send some request line
$hdl->push_write ("getinfo\015\012");
# read the response line
$hdl->push_read (line => sub {
my ($hdl, $line) = @_;
say "got line <$line>";
$cv->send;
});
$cv->recv;
=head1 DESCRIPTION
This is a helper module to make it easier to do event-based I/O
on stream-based filehandles (sockets, pipes, and other stream
things). Specifically, it doesn't work as expected on files, packet-based
sockets or similar things.
The L<AnyEvent::Intro> tutorial contains some well-documented
AnyEvent::Handle examples.
In the following, where the documentation refers to "bytes", it means
characters. As sysread and syswrite are used for all I/O, their
treatment of characters applies to this module as well.
At the very minimum, you should specify C<fh> or C<connect>, and the
C<on_error> callback.
All callbacks will be invoked with the handle object as their first
argument.
=cut
package AnyEvent::Handle;
use Scalar::Util ();
use List::Util ();
use Carp ();
use Errno qw(EAGAIN EWOULDBLOCK EINTR);
use AnyEvent (); BEGIN { AnyEvent::common_sense }
use AnyEvent::Util qw(WSAEWOULDBLOCK);
( run in 1.038 second using v1.01-cache-2.11-cpan-f56aa216473 )