line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TheSchwartz::Simple::Job; |
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
482
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
sub new_from_array { |
5
|
0
|
|
|
0
|
0
|
|
my($class, $funcname, $arg) = @_; |
6
|
0
|
|
|
|
|
|
$class->new( |
7
|
|
|
|
|
|
|
funcname => $funcname, |
8
|
|
|
|
|
|
|
arg => $arg, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
14
|
0
|
0
|
|
|
|
|
my %param = ref $_[0] ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $self = bless \%param, $class; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
$self->run_after( time ) unless defined $self->run_after; |
18
|
0
|
0
|
|
|
|
|
$self->grabbed_until( 0) unless defined $self->grabbed_until; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _accessor { |
24
|
0
|
|
|
0
|
|
|
my $self = shift; |
25
|
0
|
|
|
|
|
|
my $col = shift; |
26
|
0
|
0
|
|
|
|
|
$self->{$col} = shift if @_; |
27
|
0
|
|
|
|
|
|
$self->{$col}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub as_hashref { |
31
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my %data; |
34
|
0
|
|
|
|
|
|
for my $col (qw( jobid funcid arg uniqkey insert_time run_after grabbed_until priority coalesce )) { |
35
|
0
|
0
|
|
|
|
|
$data{$col} = $self->{$col} |
36
|
|
|
|
|
|
|
if exists $self->{$col}; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
\%data; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
0
|
|
sub jobid { shift->_accessor('jobid', @_) } |
43
|
0
|
|
|
0
|
0
|
|
sub funcid { shift->_accessor('funcid', @_) } |
44
|
0
|
|
|
0
|
0
|
|
sub arg { shift->_accessor('arg', @_) } |
45
|
0
|
|
|
0
|
0
|
|
sub uniqkey { shift->_accessor('uniqkey', @_) } |
46
|
0
|
|
|
0
|
0
|
|
sub insert_time { shift->_accessor('insert_time', @_) } |
47
|
0
|
|
|
0
|
0
|
|
sub run_after { shift->_accessor('run_after', @_) } |
48
|
0
|
|
|
0
|
0
|
|
sub grabbed_until { shift->_accessor('grabbed_until', @_) } |
49
|
0
|
|
|
0
|
0
|
|
sub priority { shift->_accessor('priority', @_) } |
50
|
0
|
|
|
0
|
0
|
|
sub coalesce { shift->_accessor('coalesce', @_) } |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
0
|
|
sub funcname { shift->_accessor('funcname', @_) } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |