line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Beanstalk::Job; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
4395
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
91
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use base qw(Class::Accessor::Fast); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
3022
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "1.07"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors( |
11
|
|
|
|
|
|
|
qw(id client buried reserved data error) |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub stats { |
15
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
16
|
0
|
0
|
|
|
|
|
$self->{_stats} = $self->client->stats_job($self->id) |
17
|
|
|
|
|
|
|
or $self->error($self->client->error); |
18
|
0
|
|
|
|
|
|
$self->{_stats}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub delete { |
22
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
my $ret = $self->client->delete($self->id) |
25
|
|
|
|
|
|
|
or $self->error($self->client->error); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self->reserved(0); |
28
|
0
|
|
|
|
|
|
$self->buried(0); |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
$ret; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub touch { |
34
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
my $ret = $self->client->touch($self->id) |
37
|
|
|
|
|
|
|
or $self->error($self->client->error); |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
$ret; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub peek { |
43
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
my $ret = $self->client->peek($self->id) |
46
|
|
|
|
|
|
|
or $self->error($self->client->error); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$ret; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub release { |
52
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
53
|
0
|
|
|
|
|
|
my $opt = shift; |
54
|
|
|
|
|
|
|
|
55
|
0
|
0
|
|
|
|
|
my $ret = $self->client->release($self->id, $opt) |
56
|
|
|
|
|
|
|
or $self->error($self->client->error); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$self->reserved(0); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
$ret; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub bury { |
64
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
65
|
0
|
|
|
|
|
|
my $opt = shift; |
66
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
unless ($self->client->bury($self->id, $opt)) { |
68
|
0
|
|
|
|
|
|
$self->error($self->client->error); |
69
|
0
|
|
|
|
|
|
return undef; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
$self->reserved(0); |
73
|
0
|
|
|
|
|
|
$self->buried(1); |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
return 1; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub args { |
79
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
80
|
0
|
|
|
|
|
|
my $data = $self->data; |
81
|
|
|
|
|
|
|
|
82
|
0
|
0
|
|
|
|
|
return unless defined($data); |
83
|
0
|
|
|
|
|
|
$self->client->decoder->($data); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub tube { |
87
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
88
|
|
|
|
|
|
|
|
89
|
0
|
0
|
0
|
|
|
|
my $stats = $self->{_stats} || $self->stats |
90
|
|
|
|
|
|
|
or return undef; |
91
|
|
|
|
|
|
|
|
92
|
0
|
|
|
|
|
|
$stats->tube; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub ttr { |
96
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
97
|
|
|
|
|
|
|
|
98
|
0
|
0
|
0
|
|
|
|
my $stats = $self->{_stats} || $self->stats |
99
|
|
|
|
|
|
|
or return undef; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
$stats->ttr; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub priority { |
105
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
106
|
|
|
|
|
|
|
|
107
|
0
|
0
|
0
|
|
|
|
my $stats = $self->{_stats} || $self->stats |
108
|
|
|
|
|
|
|
or return undef; |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$stats->pri; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
1; |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
__END__ |