File Coverage

blib/lib/Net/Gearman/Worker.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2014 -- leonerd@leonerd.org.uk
5              
6             package Net::Gearman::Worker;
7              
8 2     2   70754 use strict;
  2         4  
  2         65  
9 2     2   10 use warnings;
  2         4  
  2         85  
10              
11             our $VERSION = '0.04';
12              
13 2     2   9 use base qw( Net::Gearman Protocol::Gearman::Worker );
  2         4  
  2         685  
14              
15             =head1 NAME
16              
17             C - concrete Gearman worker over an IP socket
18              
19             =head1 SYNOPSIS
20              
21             use List::Util qw( sum );
22             use Net::Gearman::Worker;
23              
24             my $worker = Net::Gearman::Worker->new(
25             PeerAddr => $SERVER,
26             ) or die "Cannot connect - $@\n";
27              
28             $worker->can_do( 'sum' );
29              
30             while(1) {
31             my $job = $worker->grab_job->get;
32              
33             my $total = sum split m/,/, $job->arg;
34              
35             $job->complete( $total );
36             }
37              
38             =head1 DESCRIPTION
39              
40             This module combines the abstract L with
41             L to provide a simple synchronous concrete worker
42             implementation.
43              
44             =cut
45              
46             =head1 AUTHOR
47              
48             Paul Evans
49              
50             =cut
51              
52             0x55AA;