line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Job::Async::Job; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
12
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
69
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Job::Async::Job - represents a single job for L |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
2
|
|
678
|
use JSON::MaybeUTF8 qw(:v1); |
|
2
|
|
|
|
|
6586
|
|
|
2
|
|
|
|
|
576
|
|
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
0
|
0
|
0
|
sub id { shift->{id} } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub data { |
23
|
5064
|
|
|
5064
|
0
|
6728
|
my ($self, $key) = @_; |
24
|
5064
|
50
|
|
|
|
7245
|
return $self->{data} unless defined $key; |
25
|
5064
|
|
|
|
|
8974
|
return $self->{data}{$key}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub flattened_data { |
29
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
30
|
0
|
|
|
|
|
0
|
my $data = $self->{data}; |
31
|
0
|
0
|
|
|
|
0
|
return $data unless grep ref, values %$data; |
32
|
0
|
0
|
|
|
|
0
|
return { map { $_ => ref($data->{$_}) ? encode_json_utf8($data->{$_}) : $_ } keys %$data }; |
|
0
|
|
|
|
|
0
|
|
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
5069
|
|
|
5069
|
0
|
11853
|
sub future { shift->{future} } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
for my $method (qw(then get done fail else catch on_done on_cancel on_fail on_ready is_ready is_done is_failed failure)) { |
38
|
2
|
|
|
2
|
|
13
|
no strict 'refs'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
190
|
|
39
|
5067
|
|
|
5067
|
|
6710
|
*$method = sub { my $self = shift; $self->future->$method(@_) } |
|
5067
|
|
|
5067
|
|
7051
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub new { |
43
|
2532
|
|
|
2532
|
0
|
49546
|
my ($class, %args) = @_; |
44
|
2532
|
|
|
|
|
5372
|
bless \%args, $class |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |