blib/lib/Net/Async/Gearman.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 4 / 4 totaltotal 88.2% 30 / 34 CC 1 SCAR 1.3
CC
1
Cov
87%
connect
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Net/Async/Gearman/Worker.pm ↑ Summary blib/lib/Net/Async/Gearman/Client.pm »
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::Async::Gearman;
7  
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '0.01';
12  
13 2 ▶use base qw( IO::Async::Stream Protocol::Gearman );
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 =head1 NAME
16  
17 C<Net::Async::Gearman> - use Gearman with L<IO::Async>
18  
19 =head1 DESCRIPTION
20  
21 This module provides an L<IO::Async>-based wrapper around
22 L<Protocol::Gearman>. It shouldn't be used directly; see instead
23  
24 =over 2
25  
26 =item *
27  
28 L<Net::Async::Gearman::Client>
29  
30 =back
31  
32 =cut
33  
34 =head1 METHODS
35  
36 =cut
37  
38 =head2 $gearman->connect( %args ) ==> ( $gearman )
39  
40 Connects to the server. Takes the same arguments as L<IO::Async::Handle>'s
41 C<connect> method, but additionally sets a default service name of port 4730.
42  
43 =cut
44  
45 sub connect
46 {
47 0 ▶ my $self = shift;
Subroutine connect: not called CC=1 SCAR=6.9
Pod documented
48 0 my %args = @_;
49  
50 0 $self->SUPER::connect(
51 service => "4730",
52 %args,
53 );
54 }
55  
56 sub new_future
57 {
58 2 ▶ my $self = shift;
Subroutine new_future: called CC=1 SCAR=0.0
Pod documented
59 2 return $self->loop->new_future;
60 }
61  
62 sub send
63 {
64 1 ▶ my $self = shift;
Subroutine send: called CC=1 SCAR=0.0
Pod documented
65 1 my ( $bytes ) = @_;
66  
67 1 $self->write( $bytes );
68 }
69  
70 # geaman_state is OK
71  
72 sub on_read
73 {
74 1 ▶ my $self = shift;
Subroutine on_read: called CC=1 SCAR=0.0
Pod documented
75 1 my ( $buffref, $eof ) = @_;
76  
77 1 $self->Protocol::Gearman::on_read( $$buffref );
78 1 return 0;
79 }
80  
81 =head1 AUTHOR
82  
83 Paul Evans <leonerd@leonerd.org.uk>
84  
85 =cut
86  
87 2 0x55AA;
« blib/lib/Net/Async/Gearman/Worker.pm ↑ Summary blib/lib/Net/Async/Gearman/Client.pm »