line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Prophet::DatabaseSetting; |
2
|
1
|
|
|
1
|
|
35889
|
use Any::Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
3
|
|
|
|
|
|
|
extends 'Prophet::Record'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1211
|
use Params::Validate; |
|
1
|
|
|
|
|
10227
|
|
|
1
|
|
|
|
|
86
|
|
6
|
1
|
|
|
1
|
|
808
|
use JSON; |
|
1
|
|
|
|
|
16118
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has default => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has label => ( |
13
|
|
|
|
|
|
|
isa => 'Str|Undef', |
14
|
|
|
|
|
|
|
is => 'rw', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has type => (default => '__prophet_db_settings'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub BUILD { |
20
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
$self->initialize |
23
|
|
|
|
|
|
|
unless ($self->handle->record_exists(uuid => $self->uuid, type => $self->type) ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub initialize { |
27
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$self->set($self->default); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub set { |
33
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
34
|
0
|
|
|
|
|
|
my $entry; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
0
|
|
|
|
if (exists $_[1] || !ref($_[0])) { |
37
|
0
|
|
|
|
|
|
$entry = [@_]; |
38
|
|
|
|
|
|
|
} else { |
39
|
0
|
|
|
|
|
|
$entry = shift @_; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
my $content = to_json($entry, { |
43
|
|
|
|
|
|
|
canonical => 1, |
44
|
|
|
|
|
|
|
pretty => 0, |
45
|
|
|
|
|
|
|
utf8 => 1, |
46
|
|
|
|
|
|
|
allow_nonref => 0, |
47
|
|
|
|
|
|
|
}); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my %props = ( |
50
|
|
|
|
|
|
|
content => $content, |
51
|
|
|
|
|
|
|
label => $self->label, |
52
|
|
|
|
|
|
|
); |
53
|
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
if ($self->handle->record_exists( uuid => $self->uuid, type => $self->type)) { |
55
|
0
|
|
|
|
|
|
$self->set_props(props => \%props); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
0
|
|
|
|
|
|
$self->_create_record( |
59
|
|
|
|
|
|
|
uuid => $self->uuid, |
60
|
|
|
|
|
|
|
props => \%props, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_raw { |
66
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
67
|
0
|
|
|
|
|
|
my $content = $self->prop('content'); |
68
|
0
|
|
|
|
|
|
return $content; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub get { |
72
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
73
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
$self->initialize() unless $self->load(uuid => $self->uuid); |
75
|
0
|
|
|
|
|
|
my $content = $self->get_raw; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my $entry = from_json($content, { utf8 => 1 }); |
78
|
0
|
|
|
|
|
|
return $entry; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
82
|
1
|
|
|
1
|
|
582
|
no Any::Moose; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|