ZMQ::Constants - Constants for libzmq


    use ZMQ::Constants ':all'; # pulls in all constants for all versions
    use ZMQ::Constants ':v3.1.1', ':all'; # pulls in constants for 3.1.1
    use ZMQ::Constants ':v3.1.2', ':all'; # pulls in constants for 3.1.2

    # If you know what you're doing, this is the best way:
    # (i.e., explicitly import the symbols)
    use ZMQ::Constants qw(ZMQ_REQ);


libzmq is a fast-chanding beast and constants get renamed, new one gest removed, etc...

We used to auto-generate constants from the libzmq source code, but then adpating the binding code to this change got very tedious, and controling which version contains which constants got very hard to manage.

This module is now separate from ZMQ main code, and lists the constants statically. You can also specify which set of constants to pull in depending on the zmq version.

If don't care to be strict about which constants to import into your code, then don't bother with the ':vX.X.X' notation, just use like a normal module:

    use ZMQ::Constants qw(:all);     # pulls all known constants...
                                     # note: may contain extra constants
                                     # if we have clashes in the future
    use ZMQ::Constants qw(ZMQ_PUSH); # import just ZMQ_PUSH


I have checked that the constants for the following versions are available.

Note that for regular usage, you should just explicitly import what you need. The following exist to basically allow me to create a sane catalog of what's available in what version. I reiterate: IN MOST CASES YOU SHOULD JUST IMPORT WHAT YOU NEED:

    use ZMQ::Constants qw(ZMQ_REP ZMQ_REQ); # etc

Please send pullreqs if there are new constants that are not defined.

libzmq 2.1.11
libzmq 3.1.1

No ZMQ device related stuff

libzmq 3.1.2

NOTE: This is libzmq/master branch as of this writing. new constants may have been added.

Reintroduces ZMQ device related constants, and adds ZMQ_FAIL_UNROUTABLE


These functions are usually for internal use only. You should not need to use them if you're just a user


Creates a new "set" of constants for a particular version.


Gets the type for the given libzmq socket option. This is used when ZMQ::getsockopt is called to determine the underlying socket option type


Sets the type for the given libzmq socket option.




Daisuke Maki <>


The ZeroMQ module is

Copyright (C) 2010 by Daisuke Maki

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.