UniEvent::Check - run the given callback once per loop iteration, right after polling for i/o.
my $h = UniEvent::Check->new($loop); $h->event->add(sub { say 'hello' }); $h->start; $loop->run_nowait; # prints 'hello' $loop->run_nowait; # prints 'hello' again $h->stop; $loop->run_nowait; # no effect $h = UE::check sub { ... }, $loop;
The Check handle is useful for doing post-I/O actions for a loop. It is inherited from UniEvent::Handle.
All methods of UniEvent::Handle also apply.
my $handle = UniEvent::Check->create(sub { say "hi" });
Creates and starts a check handle. Alias for new($loop) + start($callback).
new($loop)
start($callback)
Constructs new Check handle and binds it to the specified event loop
Starts the check handle, i.e. makes it active for the next even loop iteration. Optionally it adds the $callback to the event listeners.
$callback
Stops the check handle, i.e. makes it inactive for the next event loop iteration.
Callback signature:
my $handle = shift; # the "check" handle itself
See "EVENT CALLBACKS" in UniEvent
Method on_check will be called.
on_check
See "EVENT LISTENER" in UniEvent
Immediately invokes assigned callbacks and listeners.
To install UniEvent, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UniEvent
CPAN shell
perl -MCPAN -e shell install UniEvent
For more information on module installation, please visit the detailed CPAN module installation guide.