line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Job::Machine::Base; |
2
|
|
|
|
|
|
|
$Job::Machine::Base::VERSION = '0.22'; |
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
5
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
54
|
|
6
|
1
|
|
|
1
|
|
274
|
use Job::Machine::DB; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
132
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
10
|
0
|
|
|
|
|
|
$args{db} = Job::Machine::DB->new( %args ); |
11
|
0
|
|
|
|
|
|
return bless \%args, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
0
|
1
|
|
sub db { return $_[0]->{db} }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub id { |
17
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
18
|
0
|
0
|
|
|
|
|
$self->{id} = $id if defined $id; |
19
|
0
|
|
|
|
|
|
return $self->{id}; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub subscribe { |
23
|
0
|
|
|
0
|
0
|
|
my ($self, $queue, $reply) = @_; |
24
|
0
|
|
0
|
|
|
|
$queue ||= $self->{queue}; |
25
|
0
|
|
0
|
|
|
|
$reply ||= 0; |
26
|
0
|
|
|
|
|
|
return $self->db->listen(queue => $queue, reply => $reply); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub log { |
30
|
0
|
|
|
0
|
1
|
|
my ($self, $msg) = @_; |
31
|
0
|
|
|
|
|
|
print STDERR $msg, "\n"; |
32
|
0
|
|
|
|
|
|
return; |
33
|
|
|
|
|
|
|
# $Carp::CarpLevel = 1; |
34
|
|
|
|
|
|
|
# carp($msg); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |