AnyEvent-Connection
view release on metacpan or search on metacpan
my $client = MyTCPClient->new(
host => 'localhost',
port => 12345,
);
$client->reg_cb(
connected => sub {
my ($client,$connection,$host,$port) = @_;
# ...
$client->after(
$interval, sub {
# Called after interval, if connection still alive
}
);
}
connfail = sub {
my ($client,$reason) = @_;
# ...
},
disconnect => sub {
my ($client,$reason) = @_;
},
lib/AnyEvent/Connection.pm view on Meta::CPAN
my $client = MyTCPClient->new(
host => 'localhost',
port => 12345,
);
$client->reg_cb(
connected => sub {
my ($client,$connection,$host,$port) = @_;
# ...
$client->after(
$interval, sub {
# Called after interval, if connection still alive
}
);
}
connfail = sub {
my ($client,$reason) = @_;
# ...
},
disconnect => sub {
my ($client,$reason) = @_;
},
lib/AnyEvent/Connection/Raw.pm view on Meta::CPAN
#warn "[\U$me->{side}\E] Error on handle: $e"; # uncomment
}
delete $me->{h};
$self->event( disconnect => "Error: $e" );
$me->_call_waiting($e);
};
$self->{timeout} ||= 30;
$self->{h} = AnyEvent::Handle->new(
fh => $self->{fh},
autocork => 1,
keepalive => 1,
on_eof => $self->{cb}{eof},
on_error => $self->{cb}{err},
);
$self;
}
sub destroy {
my ($self) = @_;
$self->DESTROY;
bless $self, "AnyEvent::Connection::Raw::destroyed";
( run in 1.048 second using v1.01-cache-2.11-cpan-df04353d9ac )