| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package AnyEvent::Gearman::Worker; |
|
2
|
3
|
|
|
3
|
|
1721
|
use Any::Moose; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
107
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
2234
|
use AnyEvent::Gearman::Types; |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
65
|
|
|
5
|
3
|
|
|
3
|
|
3228
|
use AnyEvent::Gearman::Worker::Connection; |
|
|
3
|
|
|
|
|
251
|
|
|
|
3
|
|
|
|
|
206
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
50
|
|
3
|
|
19
|
BEGIN { do { eval q[use MouseX::Foreign; 1] or die $@ } if any_moose eq 'Mouse' } |
|
|
3
|
50
|
|
3
|
|
407
|
|
|
|
3
|
|
|
|
|
28
|
|
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
27
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends any_moose('::Object'), 'Object::Event'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has job_servers => ( |
|
12
|
|
|
|
|
|
|
is => 'ro', |
|
13
|
|
|
|
|
|
|
isa => 'AnyEvent::Gearman::Worker::Connections', |
|
14
|
|
|
|
|
|
|
required => 1, |
|
15
|
|
|
|
|
|
|
coerce => 1, |
|
16
|
|
|
|
|
|
|
); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has prefix => ( |
|
19
|
|
|
|
|
|
|
is => 'ro', |
|
20
|
|
|
|
|
|
|
isa => 'Str', |
|
21
|
|
|
|
|
|
|
default => '', |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has functions => ( |
|
25
|
|
|
|
|
|
|
is => 'ro', |
|
26
|
|
|
|
|
|
|
isa => 'HashRef', |
|
27
|
|
|
|
|
|
|
default => sub { {} }, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
|
18
|
no Any::Moose; |
|
|
3
|
|
|
|
|
8
|
|
|
|
3
|
|
|
|
|
24
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub register_function { |
|
33
|
3
|
|
|
3
|
1
|
328
|
my ($self, $func_name, $code) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
3
|
50
|
|
|
|
36
|
die qq[Function "$func_name" already registered] |
|
36
|
|
|
|
|
|
|
if $self->functions->{ $func_name }; |
|
37
|
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
7
|
for my $js (@{ $self->job_servers }) { |
|
|
3
|
|
|
|
|
30
|
|
|
39
|
3
|
100
|
|
|
|
83
|
$js->context($self) unless $js->context; |
|
40
|
3
|
|
|
|
|
37
|
$js->register_function( $func_name ); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
3
|
|
|
|
|
54
|
$self->functions->{ $func_name } = $code; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub unregister_function { |
|
47
|
0
|
|
|
0
|
1
|
|
my ($self, $func_name) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
for my $js (@{ $self->job_servers }) { |
|
|
0
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
$js->context($self) unless $js->context; |
|
51
|
0
|
|
|
|
|
|
$js->unregister_function( $func_name ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |