NAME

Queue::Gearman::Message - Gearman protocol message builder and parser.

SYNOPSIS

use Socket qw/IPPROTO_TCP TCP_NODELAY/;
use IO::Socket::INET;
use Queue::Gearman::Message qw/:functions :headers HEADER_BYTES/;

my $sock = IO::Socket::INET->new(PeerHost => '127.0.0.1', PeerPort => 7003, Proto => 'tcp') or die $!;
$sock->setsockopt(IPPROTO_TCP, TCP_NODELAY, 1) or die $!;
$sock->autoflush(1);

my $msg = build_message(HEADER_REQ_SUBMIT_JOB, 'Echo', '', '{"args":{"foo":"bar"}}');
my $ret = $sock->syswrite($msg, length $msg);

my ($context, $msgtype, $bytes) = do {
    $sock->sysread(my $header, HEADER_BYTES);
    parse_header($header);
};
my @args = do {
    $sock->sysread(my $args, $bytes);
    parse_args($args);
};

$sock->close();

DESCRIPTION

Queue::Gearman::Message is ...

SEE ALSO

Gearman::Util http://gearman.org/protocol/

LICENSE

Copyright (C) karupanerura.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

karupanerura <karupa@cpan.org>