ZMQ::Raw::Poller - ZeroMQ Poller class
version 0.27
ZeroMQ Poller
use ZMQ::Raw; my $poller = ZMQ::Raw::Poller->new(); $poller->add ($socket1, ZMQ::Raw->ZMQ_POLLIN); $poller->add ($socket2, ZMQ::Raw->ZMQ_POLLIN); # wait for up to 1000ms for an event if ($poller->wait (1000)) { my $events = $poller->events ($socket1); if ($events & ZMQ::Raw->ZMQ_POLLIN) { print "POLLIN event on socket1\n"; } $events = $poller->events ($socket2); if ($events & ZMQ::Raw->ZMQ_POLLIN) { print "POLLIN event on socket2\n"; } }
Create a new poller.
Poll for $events on $socket. $events is a bitmask of values including:
$events
$socket
ZMQ::Raw->ZMQ_POLLIN
At least one message may be received from the socket without blocking.
ZMQ::Raw->ZMQ_POLLOUT
At least one message may be sent to the socket without blocking.
Remove $socket from the list of sockets to poll for events.
Retrieve the events for $socket. If $socket was not previously added to the poller this method will return undef.
undef
Wait for up to $timeout milliseconds for an event. Returns the number of items that had events.
$timeout
This method may return undef if the system call was interrupt, after which it may be reattempted.
Retrieve the number of sockets currently polled.
Jacques Germishuys <jacquesg@striata.com>
Copyright 2017 Jacques Germishuys.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install ZMQ::Raw, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ZMQ::Raw
CPAN shell
perl -MCPAN -e shell install ZMQ::Raw
For more information on module installation, please visit the detailed CPAN module installation guide.