Queue::Gearman::Message - Gearman protocol message builder and parser.
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();
Queue::Gearman::Message is ...
Gearman::Util http://gearman.org/protocol/
Copyright (C) karupanerura.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
karupanerura <karupa@cpan.org>
To install Queue::Gearman, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Queue::Gearman
CPAN shell
perl -MCPAN -e shell install Queue::Gearman
For more information on module installation, please visit the detailed CPAN module installation guide.