ZMQ
(
D/DM/DMAKI/ZMQ-1.06.tar.gz, DMAKI, 2014;
MetaCPAN
)
use JSON ();
ZMQ::register_read_type(json => \&JSON::decode_json);
ZMQ::register_write_type(json => \&JSON::encode_json);
my $sock = $ctx->socket( ... );
$sock->sendmsg_as( json =>
$payload );
my $payload = $sock->recvmsg_as( 'json' );
=head1 DESCRIPTION
You can add a simple serialization/deserialization mechanism to ZMQ by enabling this module.
To enable serialization, y
le, for JSON we do
the following (this is already done for you in ZMQ.pm if you have
JSON.pm installed):
use JSON ();
ZMQ::Serializer::register_write_type('json' => \&JSON::encode_json);