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

NAME

ZMQ::Raw::Poller - ZeroMQ Poller class

VERSION

version 0.06

DESCRIPTION

ZeroMQ Poller

SYNOPSIS

        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";
                }
        }

METHODS

new( )

Create a new poller.

add( $socket, $events )

Poll for $events on $socket. $events is a bitmask of values including:

  • 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.

events( $socket )

Retrieve the events for $socket. If $socket was not previously added to the poller this method will return undef.

wait ( $timeout )

Wait for up to $timeout milliseconds for an event. Returns the number of items that had events.

AUTHOR

Jacques Germishuys <jacquesg@striata.com>

LICENSE AND COPYRIGHT

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.