Perl Bindings

ZMQ::LibZMQ*

Source Code

Development happens at:

https://github.com/lestrrat/p5-ZMQ

The most recent release can always be found at:

http://metacpan.org/release/ZMQ-LibZMQ2
http://metacpan.org/release/ZMQ-LibZMQ3
http://metacpan.org/release/ZMQ-Constants
http://metacpan.org/release/ZMQ

Build and installation

You need to install the 0MQ library and the perl headers (usually the perl-dev package on linux) before you attempt installing the Perl bindings. Once that is done, you can install the ZMQ::LibZMQ3 Perl module (and other ZMQ::* family) like any other Perl module from CPAN (possibly as root user):

$ cpan ZMQ::LibZMQ3
(or even better, use cpanm)

This will automatically install all Perl module dependencies. You may choose to install the dependencies manually and download the release tarball from the above URL. If so, you can extract it and then simply do the following to compile, test and install the Perl bindings. Please check the README on github (https://github.com/lestrrat/p5-ZMQ) for detailed instructions.

Bug Reporting

If you encounter problems please fill a bug report at:

https://github.com/lestrrat/p5-ZMQ/issues

ZMQ::FFI

Perl zeromq bindings using libffi and FFI::Raw

ZMQ::FFI exposes a high level, transparent, OO interface to zeromq independent of the underlying libzmq version. Where semantics differ, it will dispatch to the appropriate backend for you. As it uses ffi, there is no dependency on XS or compilation.

For complete examples, source, and documentation see:
https://github.com/calid/zmq-ffi/
https://metacpan.org/module/ZMQ::FFI

ZMQx::Class

Perlish bindings based on ZMQ::LibZMQ3 and Moose

Key features are:

  • Easy setup of sockets
  • Easy setting & getting of sockopts
  • Easy sending & receiving of single- and multipart messages
  • Fork / Context handling
  • AnyEvent helpers

Get it here:

AnyEvent::ZeroMQ

(note from Author of ZMQ-LibZMQ bindings: most of below statements about advantages are correct against ZeroMQ.pm, which is old and deprecated. Also, as of 2012-12-28, below module is unmaintained for about 2 years)

Bindings with less code, more parity with the C API, support for AnyEvent, and experimental zero-copy support are available from:

https://github.com/jrockway/zeromq-raw/

https://github.com/jrockway/anyevent-zeromq/

Master is considered stable and is used in production. The zero-copy branch is experimental and probably won't get you much because Perl loves copying anyway :)

The AnyEvent bindings come with a raw AnyEvent::ZeroMQ::Handle module, and comes with an OO wrapper for each message type in ZeroMQ, allowing you to use higher-level idioms in your code.

Also note that while the bindings on CPAN come with a module called ZeroMQ::Raw, the AnyEvent support in AnyEvent::ZeroMQ does not work with that one, you need the version from jrockway's github.

Please report any bugs to the ZeroMQ mailing list or on the github page. The binding has been tested with and without ithreads and multiplicity, and with Perls 5.10-5.14.

Mailing List

Discussions about these bindings takes place on the general zeromq-dev list. Please CC the maintainer (cf. the documentation for the contact address) in any discussion.