POEx::ZMQ3::Requestor - A REQ-type ZeroMQ socket
use POE; my $zreq = POEx::ZMQ3::Requestor->new(); POE::Session->create( inline_states => { _start => sub { ## Connect to a ZeroMQ REP replier: $zreq->start( 'tcp://127.0.0.1:5665' ); ## Subscribe to all emitted events: $_[KERNEL]->post( $zreq->session_id, 'subscribe', 'all' ); }, zeromq_connected_to => sub { ## Fire off a REQ to get started. $zreq->request('ping!') }, zeromq_got_reply => sub { ## Got a reply from server. my $data = $_[ARG0]; if ($data eq 'pong!') { $zreq->request('ping!') } else { warn "Don't know what to do with $data"; $zreq->stop; } }, }, ); $poe_kernel->run;
A ZeroMQ REQ-type socket using POEx::ZMQ3::Role::Emitter.
ZeroMQ REQ and REP (Requestors and Repliers) work synchronously; a REQ is expected to start the conversation and one request should generate one reply.
$zreq->start( $rep_server );
Start the Requestor and connect to a specified REP endpoint.
$zreq->stop;
Stop the Requestor, closing out the socket and stopping the event emitter.
$zreq->request( $data );
Send a request to the remote end.
Emitted when we are initialized; $_[ARG0] is the target REP server's address.
Emitted when we receive a reply to a request; $_[ARG0] is the raw data.
POEx::ZMQ3
POEx::ZMQ3::Replier
ZMQ::LibZMQ3
http://www.zeromq.org
Jon Portnoy <avenj@cobaltirc.org>
To install POEx::ZMQ3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POEx::ZMQ3
CPAN shell
perl -MCPAN -e shell install POEx::ZMQ3
For more information on module installation, please visit the detailed CPAN module installation guide.