POE::Component::Connection::Keepalive(3pm) | User Contributed Perl Documentation | POE::Component::Connection::Keepalive(3pm) |
POE::Component::Connection::Keepalive - a wheel wrapper around a kept-alive socket
version 0.272
See the SYNOPSIS for POE::Component::Client::Keepalive for a complete working example. my $connection = $response->{connection}; $heap->{connection} = $connection; $connection->start( InputEvent => "got_input" ); delete $heap->{connection}; # When done with it.
POE::Component::Connection::Keepalive is a helper class for POE::Component::Client::Keepalive. It wraps managed sockets, providing a few extra features.
Connection objects free their underlying sockets when they are DESTROYed. This eliminates the need to explicitly free sockets when you are done with them.
Connection objects manage POE::Wheel::ReadWrite objects internally, saving a bit of effort.
my $conn = POE::Component::Connection::Keepalive->new( socket => $socket_handle, manager => $poe_component_client_keepalive, );
new() is usually called by a POE::Component::Client::Keepalive object.
# Asynchronous connection from Client::Keepalive. sub handle_connection { my $connection_info = $_[ARG0]; $_[HEAP]->{connection} = $connection_info->{connection}; $heap->{connection}->start( InputEvent => "got_input", ErrorEvent => "got_error", ); } # Stop the connection (and the wheel) when an error occurs. sub handle_error { delete $_[HEAP]->{connection}; }
$heap->{connection}->wheel()->pause_input();
POE POE::Component::Client::Keepalive POE::Wheel::ReadWrite
None known.
This distribution is copyright 2004-2009 by Rocco Caputo. All rights are reserved. This distribution is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
Rocco Caputo <rcaputo@cpan.org>
Special thanks to Rob Bloodgood.
2022-06-18 | perl v5.34.0 |