line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::FileReader; |
2
|
16
|
|
|
16
|
|
14615
|
use base 'Crypt::Keyczar::Reader'; |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
4702
|
|
3
|
16
|
|
|
16
|
|
102
|
use strict; |
|
16
|
|
|
|
|
52
|
|
|
16
|
|
|
|
|
247
|
|
4
|
16
|
|
|
16
|
|
67
|
use warnings; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
254
|
|
5
|
16
|
|
|
16
|
|
62
|
use Carp; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
4823
|
|
6
|
|
|
|
|
|
|
|
7
|
79
|
|
|
79
|
0
|
366
|
sub META_FILE {'meta'} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
79
|
|
|
79
|
0
|
212
|
my $class = shift; |
13
|
79
|
|
|
|
|
143
|
my $location = shift; |
14
|
|
|
|
|
|
|
|
15
|
79
|
|
|
|
|
243
|
my $self = bless { |
16
|
|
|
|
|
|
|
__location => $location |
17
|
|
|
|
|
|
|
}, $class; |
18
|
79
|
|
|
|
|
296
|
$self->init; |
19
|
79
|
|
|
|
|
284
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init { |
24
|
79
|
|
|
79
|
0
|
142
|
my $self = shift; |
25
|
79
|
50
|
33
|
|
|
539
|
if ($self->{__location} && $self->{__location} !~ m{/$}) { |
26
|
79
|
|
|
|
|
205
|
$self->{__location} .= '/'; |
27
|
|
|
|
|
|
|
} |
28
|
79
|
|
|
|
|
142
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_key { |
33
|
165
|
|
|
165
|
0
|
263
|
my $self = shift; |
34
|
165
|
|
|
|
|
254
|
my $version = shift; |
35
|
165
|
50
|
33
|
|
|
805
|
if (!defined $version || $version < 1) { |
36
|
0
|
|
|
|
|
0
|
croak "require version number"; |
37
|
|
|
|
|
|
|
} |
38
|
165
|
|
|
|
|
718
|
return $self->_read(sprintf '%s%d', $self->{__location}, $version); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_metadata { |
43
|
79
|
|
|
79
|
0
|
516
|
my $self = shift; |
44
|
79
|
|
|
|
|
204
|
return $self->_read(sprintf '%s%s', $self->{__location}, META_FILE); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _read { |
49
|
244
|
|
|
244
|
|
436
|
my $self = shift; |
50
|
244
|
|
|
|
|
432
|
my $path = shift; |
51
|
|
|
|
|
|
|
|
52
|
244
|
100
|
|
|
|
7634
|
open my $fh, '<', $path or croak "can't open key file: $path: $!"; |
53
|
243
|
|
|
|
|
1052
|
local $/ = undef; |
54
|
243
|
|
|
|
|
3018
|
my $contents = <$fh>; |
55
|
243
|
|
|
|
|
1435
|
close $fh; |
56
|
243
|
|
|
|
|
2098
|
return $contents; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |