Qless/BaseJob.pm

filter: Statementstmt 29.5% 13 / 44 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 4 / 16 Podpod 0.0% 0 / 12 totaltotal 22.3% 17 / 76 CC 4 SCAR 13.3
CC
4
Cov
27%
new
12.0
priority
6.0
queue
2.0
CRAP 3.8
« Qless/Client.pm ↑ Summary Qless/Config.pm »
1 package Qless::BaseJob;
2 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Qless::Utils qw(fix_empty_array);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Time::HiRes qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod undocumented
7 0 my $class = shift;
8  
9 0 my ($client, $args) = @_;
10  
11 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
12 0 my $self = bless {}, $class;
13  
14 0 $self->{'client'} = $client;
15  
16 0 $self->{'_loaded'} = {};
17 0 foreach my $key (qw(data jid priority)) {
18 0 $self->{$key} = $args->{ $key };
19 }
20  
21 0 $self->{'klass'} = $args->{'klass'};
22 0 $self->{'queue_name'} = $args->{'queue'};
23 0 $self->{'tags'} = fix_empty_array($args->{'tags'});
24  
25 0 $self;
26 }
27  
28  
29 0 ▶sub priority {
Subroutine priority: not called CC=2 SCAR=17.9
Pod undocumented
30 0 my $self = shift;
31  
32 0 ▶ if ($#_ == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#_ == 0) 0 0 0
33 0 $self->{'client'}->_priority([], $self->{'jid'}, $_[0]);
34 0 $self->{'priority'} = $_[0];
35 }
36  
37 0 return $self->{'priority'};
38 }
39  
40 0 ▶sub queue {
Subroutine queue: not called CC=1 SCAR=6.9
Pod undocumented
41 0 my ($self) = @_;
42 0 return $self->{'queue'} = $self->{'client'}->queues($self->{'queue_name'});
43 }
44  
45 0 ▶sub client { $_[0]->{'client'} }
Subroutine client: not called CC=1 SCAR=6.9
Pod undocumented
46 0 ▶sub queue_name { $_[0]->{'queue_name'} }
Subroutine queue_name: not called CC=1 SCAR=6.9
Pod undocumented
47 0 ▶sub klass { $_[0]->{'klass'} }
Subroutine klass: not called CC=1 SCAR=6.9
Pod undocumented
48 0 ▶sub data { $_[0]->{'data'} }
Subroutine data: not called CC=1 SCAR=6.9
Pod undocumented
49 0 ▶sub jid { $_[0]->{'jid'} }
Subroutine jid: not called CC=1 SCAR=6.9
Pod undocumented
50 0 ▶sub tags { $_[0]->{'tags'} }
Subroutine tags: not called CC=1 SCAR=6.9
Pod undocumented
51  
52 0 ▶sub cancel {
Subroutine cancel: not called CC=1 SCAR=6.9
Pod undocumented
53 0 my ($self) = @_;
54 0 $self->{'client'}->_cancel([], $self->{'jid'});
55 }
56  
57 0 ▶sub tag {
Subroutine tag: not called CC=1 SCAR=6.9
Pod undocumented
58 0 my ($self, @tags) = @_;
59 0 $self->{'client'}->_tag([], 'add', $self->{'jid'}, Time::HiRes::time, @tags);
60 }
61  
62 0 ▶sub untag {
Subroutine untag: not called CC=1 SCAR=6.9
Pod undocumented
63 0 my ($self, @tags) = @_;
64 0 $self->{'client'}->_tag([], 'remove', $self->{'jid'}, Time::HiRes::time, @tags);
65 }
66  
67 1 1;
68  
« Qless/Client.pm ↑ Summary Qless/Config.pm »