POE::Watcher::Input - watch a socket or other handle for input readiness
# Note, this is not a complete program.
# See the distribution's examples directory.
sub some_other :Handler {
# Request a delay notification.
my $req_socket = $socket_handle;
my $req_input = POE::Watcher::Input->new(
handle => $req_socket,
on_input => "read_from_socket",
args => \%passed_to_callbacks,
);
}
# Handle the delay notification.
sub read_from_socket {
my $req_socket;
my $octets = sysread($req_socket, my $buf = "", 65536);
...;
}
POE::Watcher::Input watches a socket or other handle and delivers a message
whenever the handle becomes ready to be read. Both the handle and the method
to call are passed to POE::Watcher::Input objects at construction time.
Construct a new POE::Watcher::Input object. The constructor takes two
parameters: "handle" is the socket or other file handle to watch for
input readiness. "on_input" is the name of the method in the current
Stage to invoke when the handle is ready to be read from.
Destroy this object to cancel it.
See <http://thirdlobe.com/projects/poe-stage/report/1> for known issues.
See <http://thirdlobe.com/projects/poe-stage/newticket> to report one.
POE::Stage is too young for production use. For example, its
syntax is still changing. You probably know what you don't like, or what you
need that isn't included, so consider fixing or adding that, or at least
discussing it with the people on POE's mailing list or IRC channel. Your
feedback and contributions will bring POE::Stage closer to usability. We
appreciate it.
POE::Watcher describes concepts that are common to all POE::Watcher classes.
It's required reading in order to understand fully what's going on.
Rocco Caputo <rcaputo@cpan.org>.
POE::Watcher::Input is Copyright 2005-2006 by Rocco Caputo. All rights are
reserved. You may use, modify, and/or distribute this module under the same
terms as Perl itself.