Qless/Config.pm

filter: Statementstmt 41.6% 10 / 24 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 33.3% 13 / 39 CC 3 SCAR 12.4
CC
3
Cov
36%
new
6.0
get
6.0
set
2.0
CRAP 3.4
« Qless/BaseJob.pm ↑ Summary Qless/Workers.pm »
1 package Qless::Config;
2 =head1 NAME
3  
4 Qless::Config
5  
6 =cut
7  
8 1 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use JSON::XS qw(decode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
12 0 my $class = shift;
13 0 my ($client) = @_;
14  
15 0 ▶ $class = ref $class if ref $class;
Branch: 1 branch
BranchTrueFalseTotal
if ref $class 0 0 0
16 0 my $self = bless {}, $class;
17  
18 0 $self->{'client'} = $client;
19  
20 0 $self;
21 }
22  
23 0 ▶sub get {
Subroutine get: not called CC=2 SCAR=17.9
Pod undocumented
24 0 my ($self, $key) = @_;
25 0 ▶ if ($key) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key) 0 0 0
26 0 return $self->{'client'}->_config([], 'get', $key);
27 }
28 0 return decode_json($self->{'client'}->_config([], 'get'));
29 }
30  
31 0 ▶sub set {
Subroutine set: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my ($self, $key, $value) = @_;
33 0 return $self->{'client'}->_config([], 'set', $key, $value);
34 }
35  
36 0 ▶sub del {
Subroutine del: not called CC=1 SCAR=6.9
Pod undocumented
37 0 my ($self, $key, $value) = @_;
38 0 return $self->{'client'}->_config([], 'unset', $key);
39 }
40  
41 1 1;
« Qless/BaseJob.pm ↑ Summary Qless/Workers.pm »