<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    POEx::ZMQ - Asynchronous ZeroMQ sockets for POE

SYNOPSIS
      # An example ZMQ_ROUTER socket -&gt;
      use POE;
      use POEx::ZMQ;

      POE::Session-&gt;create(
        inline_states =&gt; +{
          _start =&gt; sub {
            # Set up a ROUTER
            # Save our POEx::ZMQ for creating other sockets w/ shared context later:
            my $zmq = POEx::ZMQ-&gt;new;
            $_[HEAP]-&gt;{zeromq} = $zmq;

            $_[HEAP]-&gt;{rtr} = $zmq-&gt;socket( type =&gt; ZMQ_ROUTER );

            $_[HEAP]-&gt;{rtr}-&gt;start;

            $_[HEAP]-&gt;{rtr}-&gt;bind( 'tcp://127.0.0.1:1234' );
          },

          zmq_recv_multipart =&gt; sub {
            # ROUTER got message from REQ; sender identity is prefixed,
            # parts are available as a List::Objects::WithUtils::Array -&gt;
            my $parts = $_[ARG0];
            my ($id, undef, $content) = $parts-&gt;all;

            my $response = 'foo';

            # $_[SENDER] was the ROUTER socket, send a response back:
            $_[KERNEL]-&gt;post( $_[SENDER], send_multipart =&gt;
              $id, '', $response
            );
          },
        },
      );

      POE::Kernel-&gt;run;

DESCRIPTION
    A POE component providing non-blocking ZeroMQ &lt;http://www.zeromq.org&gt;
    (versions 3.x &amp; 4.x) integration.

    See POEx::ZMQ::Socket for details on using these sockets.

    See the zguide &lt;http://zguide.zeromq.org&gt; for more on using ZeroMQ in
    general.

    Each ZeroMQ socket is an event emitter powered by
    MooX::Role::POE::Emitter; the documentation for that distribution is
    likely to be helpful.

    This is early-development software, as indicated by the "0.x" version
    number. The test suite is incomplete, bugs are sure to be lurking,
    documentation is not yet especially verbose, and the API is not
    completely guaranteed. Issues &amp; pull requests are welcome, of course:
    &lt;http://www.github.com/avenj/poex-zmq&gt;

    If you are not using POE, try ZMQ::FFI for an excellent loop-agnostic
    ZeroMQ implementation.

  import
    Importing this package brings in the full set of POEx::ZMQ::Constants,
    and ensures POEx::ZMQ::Socket is loaded.

   new
      my $zmq = POEx::ZMQ-&gt;new;
      # POEx::ZMQ::FFI::Context obj is automatically shared:
      my $frontend = $zmq-&gt;socket(type =&gt; ZMQ_ROUTER);
      my $backend  = $zmq-&gt;socket(type =&gt; ZMQ_ROUTER);

    This class can be instanced, in which case it will hang on to the first
    "context" created (possibly implicitly via a call to "socket") and use
    that POEx::ZMQ::FFI::Context instance for all calls to "socket".

   context
      my $ctx = POEx::ZMQ-&gt;context(max_sockets =&gt; 512);

    If called as a class method, returns a new POEx::ZMQ::FFI::Context.

      my $zmq = POEx::ZMQ-&gt;new;
      my $ctx = $zmq-&gt;context;

    If called as an object method, returns the context object belonging to
    the instance. If none currently exists, a new POEx::ZMQ::FFI::Context is
    created (and preserved for use during socket creation; see "socket").

    If creating a new context object, @_ is passed through to the
    POEx::ZMQ::FFI::Context constructor.

    The context object should be shared between sockets belonging to the
    same process -- a forked child process must create a new context with
    its own set of sockets.

   socket
      my $sock = POEx::ZMQ-&gt;socket(context =&gt; $ctx, type =&gt; ZMQ_ROUTER);

    If called as a class method, returns a new POEx::ZMQ::Socket using
    either a provided "context" or, if missing from arguments, a
    freshly-created POEx::ZMQ::FFI::Context.

      my $sock = $zmq-&gt;socket(type =&gt; ZMQ_ROUTER);

    If called as an object method, returns a new POEx::ZMQ::Socket that uses
    the POEx::ZMQ::FFI::Context object belonging to the instance; see
    "context".

    @_ is passed through to the POEx::ZMQ::Socket constructor.

AUTHOR
    Jon Portnoy &lt;avenj@cobaltirc.org&gt;

    Significant portions of the POEx::ZMQ::FFI backend are inspired by or
    derived from ZMQ::FFI (version 0.14) by Dylan Cali (CPAN: CALID).

    Licensed under the same terms as Perl.

</pre></body></html>