File Coverage

blib/lib/Net/Gearman/Worker.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 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,2026 -- leonerd@leonerd.org.uk
5              
6             package Net::Gearman::Worker 0.05;
7              
8 2     2   172531 use v5.20;
  2         7  
9 2     2   8 use warnings;
  2         4  
  2         117  
10              
11 2     2   8 use feature qw( postderef signatures );
  2         3  
  2         208  
12 2     2   7 no warnings qw( experimental::postderef experimental::signatures );
  2         2  
  2         64  
13              
14 2     2   7 use base qw( Net::Gearman Protocol::Gearman::Worker );
  2         8  
  2         518  
15              
16             =head1 NAME
17              
18             C - concrete Gearman worker over an IP socket
19              
20             =head1 SYNOPSIS
21              
22             =for highlighter language=perl
23              
24             use List::Util qw( sum );
25             use Net::Gearman::Worker;
26              
27             my $worker = Net::Gearman::Worker->new(
28             PeerAddr => $SERVER,
29             ) or die "Cannot connect - $@\n";
30              
31             $worker->can_do( 'sum' );
32              
33             while(1) {
34             my $job = $worker->grab_job->get;
35              
36             my $total = sum split m/,/, $job->arg;
37              
38             $job->complete( $total );
39             }
40              
41             =head1 DESCRIPTION
42              
43             This module combines the abstract L with
44             L to provide a simple synchronous concrete worker
45             implementation.
46              
47             =cut
48              
49             =head1 AUTHOR
50              
51             Paul Evans
52              
53             =cut
54              
55             0x55AA;