Supply::Timeout - Supply wrapper which can terminate by timeout.
use Supply::Timeout;
react {
whenever IO::Socket::Async.listen('0.0.0.0', 3333) -> $conn {
whenever Supply::Timeout.new($conn.Supply.lines, 4) -> $line {
$conn.print("$line\n");
QUIT {
when X::Supply::Timeout {
$conn.print("TIMEOUT\n");
$conn.close;
}
}
}
}
whenever signal(SIGINT) { done(); exit; }
}
Supply::Timeout can surround your Supply by another one with ability to interrupt in case timeout happend.
Default constructor
Accessor to the internal Supply instance.
Accessor to the timeout value.
Method which produce new Supply with timeout functionality.
cono q@cono.org.ua
Copyright 2018 cono
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.