NAME
ZeroMQ - A ZeroMQ2 wrapper for Perl
SYNOPSIS
use ZeroMQ qw/:all/;
my $cxt = ZeroMQ::Context->new;
my $sock = ZeroMQ::Socket->new($cxt, ZMQ_REP);
$sock->bind($addr);
my $msg;
foreach (1..$roundtrip_count) {
$msg = $sock->recv();
die "Bad size" if $msg->size() != $msg_size;
$sock->send($msg);
}
See the xt/ directory for full examples.
DESCRIPTION
The ZeroMQ
module is a wrapper of the 0MQ message passing library for Perl. It's a thin wrapper around the C++ API.
Loading ZeroMQ
will make the ZeroMQ::Context, ZeroMQ::Socket, and ZeroMQ::Message classes available as well.
EXPORTS
You may choose to import one or more (using the :all
import tag) constants into your namespace by supplying arguments to the use ZeroMQ
call as shown in the synopsis above.
The exportable constants are:
Socket types
ZMQ_REQ ZMQ_REP ZMQ_PUB ZMQ_SUB ZMQ_DOWNSTREAM ZMQ_UPSTREAM ZMQ_PAIR
Socket recv flags
ZMQ_NOBLOCK
get/setsockopt options
ZMQ_RCVMORE ZMQ_HWM ZMQ_SWAP ZMQ_AFFINITY ZMQ_IDENTITY ZMQ_RATE ZMQ_RECOVERY_IVL ZMQ_MCAST_LOOP ZMQ_SNDBUF ZMQ_RCVBUF ZMQ_SUBSCRIBE ZMQ_UNSUBSCRIBE
CAVEATS
This is an early release. Proceed with caution, please report (or better yet: fix) bugs you encounter. Tested againt 0MQ 2.0.7.
Use of the inproc://
transport layer doesn't seem to work between two perl ithreads. This may be due to the fact that right now, context aren't shared between ithreads and inproc
works only within a single context. Try another transport layer until contexts can be shared.
SEE ALSO
ZeroMQ::Context, ZeroMQ::Socket, ZeroMQ::Message
ExtUtils::XSpp, Module::Build::WithXSpp
AUTHOR
Steffen Mueller, <smueller@cpan.org>
COPYRIGHT AND LICENSE
The ZeroMQ module is
Copyright (C) 2010 by Steffen Mueller
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.