AnyEvent::Handle::ZeroMQ - Integrate AnyEvent and ZeroMQ with AnyEvent::Handle like ways.
Version 0.09
use AnyEvent::Handle::ZeroMQ; use AE; use ZeroMQ; my $ctx = ZeroMQ::Context->new; my $socket = $ctx->socket(ZMQ_XREP); $socket->bind('tcp://0:8888'); my $hdl = AnyEvent::Handle::ZeroMQ->new( socket => $socket, on_drain => sub { print "the write queue is empty\n" }, on_error => sub { my($error_msg) = @_; ... }, # catch errors when occured in the reading callback ); # or $hdl->on_drain( sub { ... } ); # or $hdl->on_error( sub { ... } ); $hdl->push_read( sub { my($hdl, $data) = @_; my @out; while( defined( my $msg = shift @$data ) ) { push @out, $msg; last if $msg->size == 0; } while( my $msg = shift @$data ) { print "get: ",$msg->data,$/; } push @out, "get!"; $hdl->push_write(\@out); } ); AE::cv->recv;
There is also a module called AnyEvent::ZeroMQ in CPAN.
AnyEvent::ZeroMQ::* is a huge, heavy, and full-functioned framework, but this module is a simple, lightweight library with less dependency, and runs faster.
So this module is only occupy a smaller namespace under AnyEvent::Handle::
This module and AnyEvent::ZeroMQ::* are not replacable to each other.
Cindy Wang (CindyLinz)
Please report any bugs or feature requests to bug-anyevent-handle-zeromq at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=AnyEvent-Handle-ZeroMQ. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-anyevent-handle-zeromq at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc AnyEvent::Handle::ZeroMQ
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
http://rt.cpan.org/NoAuth/Bugs.html?Dist=AnyEvent-Handle-ZeroMQ
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/AnyEvent-Handle-ZeroMQ
CPAN Ratings
http://cpanratings.perl.org/d/AnyEvent-Handle-ZeroMQ
Search CPAN
http://search.cpan.org/dist/AnyEvent-Handle-ZeroMQ/
Copyright 2011 Cindy Wang (CindyLinz).
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install AnyEvent::Handle::ZeroMQ, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Handle::ZeroMQ
CPAN shell
perl -MCPAN -e shell install AnyEvent::Handle::ZeroMQ
For more information on module installation, please visit the detailed CPAN module installation guide.