line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::KeyVersion; |
2
|
15
|
|
|
15
|
|
77
|
use strict; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
573
|
|
3
|
15
|
|
|
15
|
|
89
|
use warnings; |
|
15
|
|
|
|
|
23
|
|
|
15
|
|
|
|
|
420
|
|
4
|
15
|
|
|
15
|
|
9817
|
use Crypt::Keyczar::Util qw(json_true json_false); |
|
15
|
|
|
|
|
39
|
|
|
15
|
|
|
|
|
1677
|
|
5
|
15
|
|
|
15
|
|
112
|
use Carp; |
|
15
|
|
|
|
|
28
|
|
|
15
|
|
|
|
|
10149
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
179
|
|
|
179
|
0
|
408
|
my $class = shift; |
11
|
179
|
|
|
|
|
305
|
my ($version, $status, $exportable) = @_; |
12
|
179
|
|
|
|
|
578
|
my $self = bless { |
13
|
|
|
|
|
|
|
exportable => json_false(), |
14
|
|
|
|
|
|
|
status => 'ACTIVE', |
15
|
|
|
|
|
|
|
version_number => 0, |
16
|
|
|
|
|
|
|
}, $class; |
17
|
179
|
100
|
|
|
|
1665
|
$self->exportable($exportable) if defined $exportable; |
18
|
179
|
50
|
|
|
|
2465
|
$self->status($status) if defined $status; |
19
|
179
|
50
|
|
|
|
533
|
$self->{version_number} = $version if defined $version; |
20
|
179
|
|
|
|
|
683
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub create { |
24
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
25
|
0
|
|
|
|
|
0
|
my $opt = shift; |
26
|
0
|
|
|
|
|
0
|
return $class->new($opt->{versionNumber}, $opt->{status}, $opt->{exportable}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub read { |
30
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
31
|
0
|
|
|
|
|
0
|
my $json_string = shift; |
32
|
0
|
|
|
|
|
0
|
my $obj = from_json($json_string); |
33
|
0
|
|
|
|
|
0
|
return bless $obj, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub exportable { |
39
|
162
|
|
|
162
|
0
|
227
|
my $self = shift; |
40
|
162
|
50
|
|
|
|
1358
|
$self->{exportable} = $_[0] ? json_true() : json_false() if @_; |
|
|
50
|
|
|
|
|
|
41
|
162
|
50
|
|
|
|
1017
|
return $self->{exportable} eq json_true() ? 1 : undef; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub status { |
46
|
450
|
|
|
450
|
0
|
533
|
my $self = shift; |
47
|
450
|
100
|
|
|
|
936
|
if (@_) { |
48
|
216
|
100
|
|
|
|
682
|
if (uc $_[0] eq 'ACTIVE') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
49
|
115
|
|
|
|
|
303
|
$self->{status} = uc $_[0]; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
elsif (uc $_[0] eq 'PRIMARY') { |
52
|
77
|
|
|
|
|
175
|
$self->{status} = uc $_[0]; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
elsif (uc $_[0] eq 'INACTIVE') { |
55
|
24
|
|
|
|
|
61
|
$self->{status} = uc $_[0]; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
else { |
58
|
0
|
|
|
|
|
0
|
croak "unknown key status: $_[0]"; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
450
|
|
|
|
|
1411
|
return $self->{status}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub get_number { |
66
|
795
|
|
|
795
|
0
|
1011
|
my $self = shift; |
67
|
795
|
50
|
|
|
|
1695
|
$self->{version_number} = shift if @_; |
68
|
795
|
|
|
|
|
4054
|
return $self->{version_number}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub expose { |
74
|
120
|
|
|
120
|
0
|
189
|
my $self = shift; |
75
|
120
|
|
|
|
|
252
|
my $expose = {}; |
76
|
120
|
50
|
|
|
|
401
|
$expose->{exportable} = $self->{exportable} ? json_true() : json_false(); |
77
|
120
|
|
|
|
|
697
|
$expose->{status} = $self->{status}; |
78
|
120
|
|
|
|
|
275
|
$expose->{versionNumber} = $self->{version_number}; |
79
|
120
|
|
|
|
|
439
|
return $expose; |
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
0
|
0
|
|
sub to_string { return to_json($_[0]->expose) } |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
__END__ |