Gearman.pm

filter: Statementstmt 85.7% 18 / 21 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 100% 4 / 4 totaltotal 87.5% 28 / 32 CC 1 SCAR 1.3
CC
1
Cov
86%
connect
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Gearman/Worker.pm ↑ Summary 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,2026 -- leonerd@leonerd.org.uk
5  
6 package Net::Async::Gearman 0.02;
7  
8 2 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use base qw( IO::Async::Stream Protocol::Gearman );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head1 NAME
14  
15 C<Net::Async::Gearman> - use Gearman with L<IO::Async>
16  
17 =head1 DESCRIPTION
18  
19 =for highlighter language=perl
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 connect
39  
40 $gearman = await $gearman->connect( %args );
41  
42 Connects to the server. Takes the same arguments as L<IO::Async::Handle>'s
43 C<connect> method, but additionally sets a default service name of port 4730.
44  
45 =cut
46  
47 sub connect
48 0 ▶{
Subroutine connect: not called CC=1 SCAR=6.9
Pod documented
49 0 my $self = shift;
50 0 my %args = @_;
51  
52 0 $self->SUPER::connect(
53 service => "4730",
54 %args,
55 );
56 }
57  
58 sub new_future
59 2 ▶{
Subroutine new_future: called CC=1 SCAR=0.0
Pod documented
60 2 my $self = shift;
61 2 return $self->loop->new_future;
62 }
63  
64 sub send
65 1 ▶{
Subroutine send: called CC=1 SCAR=0.0
Pod documented
66 1 my $self = shift;
67 1 my ( $bytes ) = @_;
68  
69 1 $self->write( $bytes );
70 }
71  
72 # geaman_state is OK
73  
74 sub on_read
75 1 ▶{
Subroutine on_read: called CC=1 SCAR=0.0
Pod documented
76 1 my $self = shift;
77 1 my ( $buffref, $eof ) = @_;
78  
79 1 $self->Protocol::Gearman::on_read( $$buffref );
80 1 return 0;
81 }
82  
83 =head1 AUTHOR
84  
85 Paul Evans <leonerd@leonerd.org.uk>
86  
87 =cut
88  
89 2 0x55AA;
« Gearman/Worker.pm ↑ Summary Gearman/Client.pm »