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::Async::Gearman::Client; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
82979
|
use strict; |
|
2
|
|
|
|
|
28
|
|
|
2
|
|
|
|
|
68
|
|
9
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
94
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
11
|
use base qw( Net::Async::Gearman Protocol::Gearman::Client ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1330
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
C - concrete Gearman client over an L |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use IO::Async::Loop; |
22
|
|
|
|
|
|
|
use Net::Async::Gearman::Client; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $loop = IO::Async::Loop->new; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $client = Net::Async::Gearman::Client->new; |
27
|
|
|
|
|
|
|
$loop->add( $client ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$client->connect( |
30
|
|
|
|
|
|
|
host => $SERVER |
31
|
|
|
|
|
|
|
)->then( sub { |
32
|
|
|
|
|
|
|
$client->submit_job( |
33
|
|
|
|
|
|
|
func => "sum", |
34
|
|
|
|
|
|
|
arg => "10,20,30" |
35
|
|
|
|
|
|
|
) |
36
|
|
|
|
|
|
|
})->then( sub { |
37
|
|
|
|
|
|
|
my ( $total ) = @_; |
38
|
|
|
|
|
|
|
say $total; |
39
|
|
|
|
|
|
|
Future->done; |
40
|
|
|
|
|
|
|
})->get; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This module combines the abstract L with |
45
|
|
|
|
|
|
|
L to provide an asynchronous concrete Gearman client |
46
|
|
|
|
|
|
|
implementation. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
It provides no new methods of its own; all of the Gearman functionality comes |
49
|
|
|
|
|
|
|
from C. See that module's documentation for more |
50
|
|
|
|
|
|
|
information. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 AUTHOR |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Paul Evans |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
0x55AA; |