line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::FileWriter; |
2
|
1
|
|
|
1
|
|
22727
|
use base 'Crypt::Keyczar::Writer'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
545
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
6
|
1
|
|
|
1
|
|
6
|
use File::Path; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
487
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub location { |
10
|
233
|
|
|
233
|
0
|
337
|
my $self = shift; |
11
|
233
|
100
|
|
|
|
652
|
if (@_) { |
12
|
58
|
|
100
|
|
|
214
|
my $l = shift || ''; |
13
|
58
|
|
|
|
|
174
|
$l =~ s{/$}{}; |
14
|
58
|
|
|
|
|
155
|
$self->{location} = $l; |
15
|
|
|
|
|
|
|
} |
16
|
233
|
|
|
|
|
6511
|
return $self->{location}; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub put_metadata { |
21
|
57
|
|
|
57
|
0
|
110
|
my $self = shift; |
22
|
57
|
|
|
|
|
112
|
my $meta = shift; |
23
|
|
|
|
|
|
|
|
24
|
57
|
100
|
|
|
|
139
|
if (!-d $self->location) { |
25
|
6
|
|
|
|
|
19
|
mkpath([$self->location], 0, 0755); |
26
|
|
|
|
|
|
|
} |
27
|
57
|
|
|
|
|
193
|
my $path = sprintf '%s/meta', $self->location; |
28
|
57
|
|
|
|
|
271
|
_put($path, $meta->to_string); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub put_key { |
33
|
23
|
|
|
23
|
0
|
44
|
my $self = shift; |
34
|
23
|
|
|
|
|
52
|
my ($version, $key) = @_; |
35
|
|
|
|
|
|
|
|
36
|
23
|
100
|
|
|
|
71
|
if (!-d $self->location) { |
37
|
3
|
|
|
|
|
10
|
mkpath([$self->location], 0, 0755); |
38
|
|
|
|
|
|
|
} |
39
|
23
|
|
|
|
|
69
|
my $path = sprintf '%s/%u', $self->location, $version; |
40
|
23
|
|
|
|
|
204
|
_put($path, $key->to_string); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub delete_key { |
45
|
6
|
|
|
6
|
0
|
11
|
my $self = shift; |
46
|
6
|
|
|
|
|
12
|
my $version = shift; |
47
|
6
|
|
|
|
|
15
|
my $path = sprintf '%s/%u', $self->location, $version; |
48
|
6
|
|
|
|
|
889
|
return unlink($path) == 1; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _put { |
53
|
80
|
|
|
80
|
|
153
|
my $path = shift; |
54
|
80
|
|
|
|
|
123
|
my $json = shift; |
55
|
|
|
|
|
|
|
|
56
|
80
|
50
|
|
|
|
185201
|
open my $fh, '>', $path or croak "can't open file: $path: $!"; |
57
|
80
|
|
|
|
|
1318396
|
print $fh $json, "\n"; |
58
|
80
|
|
|
|
|
569057
|
close $fh; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |