Rand Stats




Net::ZMQ is a Perl 6 library that may be used to interact with ZeroMQ library.

use Net::ZMQ4;            # Your main import
use Net::ZMQ4::Constants; # Basic constants

my Net::ZMQ4::Context $ctx .= new;

my Net::ZMQ4::Socket $Rize .= new($ctx, ZMQ_PULL);
my Net::ZMQ4::Socket $Sharo .= new($ctx, ZMQ_PUSH);

# Single message
$Sharo.send('Kuru Kuru');
# Splitted message
$Sharo.sendmore('Cats', 'Dogs', 'Rabbits');

my $msg = $Rize.receive; # Pure ZMQ message
say $msg.data;           # bytes
say $msg.data-str;       # 'Kuru Kuru'
$msg.close;              # Don't forget to close your messages!

# Multi-receive
loop {
    my $msg = $Rize.receive(0); # Can take flags as arguments, 0 is default
    say $msg.data-str;
    unless $Rize.getopt(ZMQ_RCVMORE) == 1 {
        last; # If there are no pieces
# Says:
# Cats
# Dogs
# Rabbits

Supported version

Main supported ZMQ version is 4.1. Support of 4.2 is planned.


If you noticed a bug, have a desire to see some feature implemented, feel free to open a ticket on github's issues page of the project.


The library was written by Arne Skjærholt(arnsholt on github) with a help of many others(see Contributors page).

Altai-man made small cosmetic changes too.


The project is still relatively unstable and thus wants some love. :) All new issues and pull requests are welcome.

Efforts may be spend on: