NAME
ZMQ - Perl-ish Interface libzmq
SYNOPSIS
use ZMQ;
use ZMQ::Constants qw(ZMQ_PUB);
my $cxt = ZMQ::Context->new(5);
my $sock = $cxt->socket( ZMQ_PUB );
$sock->bind( "tcp://192.168.11.5:9999" );
if ( $ZMQ::BACKEND eq 'ZMQ::LibZMQ2' ) {
$sock->send( ZMQ::Message->new( "Hello" ) );
} elsif ( $ZMQ::BACKEND eq 'ZMQ::LibZMQ3' ) {
$sock->sendmsg( ZMQ::Message->new( "Hello" ) );
}
DESCRIPTION
ZMQ is a Perl-ish wrapper for libzmq. It uses ZMQ::LibZMQ2 or ZMQ::LibZMQ3 (ZMQ::LibZMQ2 is the default)
If you want a one-to-one direct mapping to libzmq, then you should be using ZMQ::LibZMQ2, ZMQ::LibZMQ3 directly
ZMQ will automatically choose the backend (either ZMQ::LibZMQ2 or ZMQ::LibZMQ3) to use. This can be explicitly specified by setting PERL_ZMQ_BACKEND
environment variable.
By default ZMQ::LibZMQ2 will be used as the backend. This may change in future versions, so make sure to explicitly set your backend if you don't want it to change:
BEGIN {
$ENV{ PERL_ZMQ_BACKEND } = 'ZMQ::LibZMQ2';
}
use ZMQ;
FUNCTIONS
ZMQ::call( $funcname, @args )
Calls $funcname
via whichever backend loaded by ZMQ.pm. For example if ZMQ::LibZMQ2 is loaded:
use ZMQ;
my $version = ZMQ::call( "zmq_version" ); # calls ZMQ::LibZMQ2::zmq_version
If @args
is passed, they are passed directly to the target function.
SEE ALSO
http://github.com/lestrrat/p5-ZMQ
AUTHOR
Daisuke Maki <daisuke@endeworks.jp>
COPYRIGHT AND LICENSE
The ZMQ module is
Copyright (C) 2012 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.