File Coverage

blib/lib/Net/Async/Gearman.pm
Criterion Covered Total %
statement 17 20 85.0
branch n/a
condition n/a
subroutine 6 7 85.7
pod 4 4 100.0
total 27 31 87.1


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::Async::Gearman 0.02;
7              
8 2     2   275729 use v5.20;
  2         7  
9 2     2   12 use warnings;
  2         2  
  2         134  
10              
11 2     2   13 use base qw( IO::Async::Stream Protocol::Gearman );
  2         3  
  2         1183  
12              
13             =head1 NAME
14              
15             C - use Gearman with L
16              
17             =head1 DESCRIPTION
18              
19             =for highlighter language=perl
20              
21             This module provides an L-based wrapper around
22             L. It shouldn't be used directly; see instead
23              
24             =over 2
25              
26             =item *
27              
28             L
29              
30             =back
31              
32             =cut
33              
34             =head1 METHODS
35              
36             =cut
37              
38             =head2 connect
39              
40             $gearman = await $gearman->connect( %args );
41              
42             Connects to the server. Takes the same arguments as L's
43             C method, but additionally sets a default service name of port 4730.
44              
45             =cut
46              
47             sub connect
48             {
49 0     0 1 0 my $self = shift;
50 0         0 my %args = @_;
51              
52 0         0 $self->SUPER::connect(
53             service => "4730",
54             %args,
55             );
56             }
57              
58             sub new_future
59             {
60 2     2 1 151279 my $self = shift;
61 2         10 return $self->loop->new_future;
62             }
63              
64             sub send
65             {
66 1     1 1 123 my $self = shift;
67 1         2 my ( $bytes ) = @_;
68              
69 1         7 $self->write( $bytes );
70             }
71              
72             # geaman_state is OK
73              
74             sub on_read
75             {
76 1     1 1 3670 my $self = shift;
77 1         2 my ( $buffref, $eof ) = @_;
78              
79 1         6 $self->Protocol::Gearman::on_read( $$buffref );
80 1         261 return 0;
81             }
82              
83             =head1 AUTHOR
84              
85             Paul Evans
86              
87             =cut
88              
89             0x55AA;