The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PerlIO::via::Timeout::Strategy::AlarmWithReset - like PerlIO::via::Timeout::Strategy::Alarm, but ECONNRESET after timeout

VERSION

version 0.11

SYNOPSIS

  use PerlIO::via::Timeout qw(timeout_strategy);
  binmode($fh, ':via(Timeout)');
  timeout_strategy($fh, 'Alarm', read_timeout => 0.5);

DESCRIPTION

This class implements a timeout strategy to be used by PerlIO::via::Timeout.

This strategy is like PerlIO::via::Timeout::Strategy::Alarm (it inherits from it), but in addition, it adds this behaviour: once a timeout has been hit, subsequent use of the handle will return undef and $! will be set to ECONNRESET. This can be checked by using the is_valid method.

METHODS

new

Constructor of the strategy. Takes as arguments a list of key / values :

read_timeout

The read timeout in second. Can be a float

write_timeout

The write timeout in second. Can be a float

timeout_enabled

Boolean. Defaults to 1

is_valid

  $strategy->is_valid()

Returns wether the socket from the strategy is still valid.

SEE ALSO

PerlIO::via::Timeout

AUTHOR

Damien "dams" Krotkine

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Damien "dams" Krotkine.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.