line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Qless::Config; |
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Qless::Config |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=cut |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
9
|
1
|
|
|
1
|
|
4
|
use JSON::XS qw(decode_json); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
240
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
13
|
0
|
|
|
|
|
|
my ($client) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
16
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$self->{'client'} = $client; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $key) = @_; |
25
|
0
|
0
|
|
|
|
|
if ($key) { |
26
|
0
|
|
|
|
|
|
return $self->{'client'}->_config([], 'get', $key); |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
return decode_json($self->{'client'}->_config([], 'get')); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub set { |
32
|
0
|
|
|
0
|
0
|
|
my ($self, $key, $value) = @_; |
33
|
0
|
|
|
|
|
|
return $self->{'client'}->_config([], 'set', $key, $value); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub del { |
37
|
0
|
|
|
0
|
0
|
|
my ($self, $key, $value) = @_; |
38
|
0
|
|
|
|
|
|
return $self->{'client'}->_config([], 'unset', $key); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |