The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

AnyEvent::Handle::ZeroMQ - Integrate AnyEvent and ZeroMQ with AnyEvent::Handle like ways.

VERSION

Version 0.01

SYNOPSIS

    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);
    $hdl->push_read( sub {
        my($hdl, $data) = @_;

        my @out;
        while( 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;

SUBROUTINES/METHODS

new( socket => $zmq_socket )

push_read( cb($hdl, $data (array_ref) )

push_write( $data (array_ref) )

AUTHOR

Cindy Wang (CindyLinz)

BUGS

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.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc AnyEvent::Handle::ZeroMQ

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

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.