/usr/share/doc/libzeromq-perl/examples/hello_server.pl is in libzeromq-perl 0.23-1build4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #!/usr/bin/env perl
use strict;
use ZeroMQ qw(ZMQ_REP);
my ($host, $port);
if (@ARGV >= 2) {
($host, $port) = @ARGV;
} elsif (@ARGV) {
if ($ARGV[0] =~ /^([\w\.]+):(\d+)$/) {
($host, $port) = ($1, $2);
} else {
$host = $ARGV[0];
}
}
$host ||= '127.0.0.1';
$port ||= 5566;
my $ctxt = ZeroMQ::Context->new();
my $sock = $ctxt->socket(ZMQ_REP);
$sock->bind( "tcp://$host:$port" );
while (1) {
my $message = $sock->recv();
print $message->data, "\n";
$sock->send("world");
}
|