Coro::Timer - timers and timeouts, independent of any event loop
# This package is mostly obsoleted by Coro::AnyEvent. use Coro::Timer qw(timeout); # nothing exported by default
This package has been mostly obsoleted by Coro::AnyEvent, the only really useful function left in here is timeout.
timeout
This function will wake up the current coroutine after $seconds seconds and sets $flag to true (it is false initially). If $flag goes out of scope earlier then nothing happens.
This is used by Coro itself to implement the timed_down, timed_wait etc. primitives. It is used like this:
timed_down
timed_wait
sub timed_wait { my $timeout = Coro::Timer::timeout 60; while (condition false) { Coro::schedule; # wait until woken up or timeout return 0 if $timeout; # timed out } return 1; # condition satisfied }
Marc Lehmann <schmorp@schmorp.de> http://home.schmorp.de/
To install Coro, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Coro
CPAN shell
perl -MCPAN -e shell install Coro
For more information on module installation, please visit the detailed CPAN module installation guide.