line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Keyczar::FileReader; |
2
|
16
|
|
|
16
|
|
29525
|
use base 'Crypt::Keyczar::Reader'; |
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
14777
|
|
3
|
16
|
|
|
16
|
|
91
|
use strict; |
|
16
|
|
|
|
|
60
|
|
|
16
|
|
|
|
|
798
|
|
4
|
16
|
|
|
16
|
|
83
|
use warnings; |
|
16
|
|
|
|
|
31
|
|
|
16
|
|
|
|
|
353
|
|
5
|
16
|
|
|
16
|
|
76
|
use Carp; |
|
16
|
|
|
|
|
25
|
|
|
16
|
|
|
|
|
7929
|
|
6
|
|
|
|
|
|
|
|
7
|
79
|
|
|
79
|
0
|
657
|
sub META_FILE {'meta'} |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
79
|
|
|
79
|
0
|
248
|
my $class = shift; |
13
|
79
|
|
|
|
|
122
|
my $location = shift; |
14
|
|
|
|
|
|
|
|
15
|
79
|
|
|
|
|
341
|
my $self = bless { |
16
|
|
|
|
|
|
|
__location => $location |
17
|
|
|
|
|
|
|
}, $class; |
18
|
79
|
|
|
|
|
3944
|
$self->init; |
19
|
79
|
|
|
|
|
464
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub init { |
24
|
79
|
|
|
79
|
0
|
351
|
my $self = shift; |
25
|
79
|
50
|
33
|
|
|
894
|
if ($self->{__location} && $self->{__location} !~ m{/$}) { |
26
|
79
|
|
|
|
|
241
|
$self->{__location} .= '/'; |
27
|
|
|
|
|
|
|
} |
28
|
79
|
|
|
|
|
138
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub get_key { |
33
|
165
|
|
|
165
|
0
|
252
|
my $self = shift; |
34
|
165
|
|
|
|
|
204
|
my $version = shift; |
35
|
165
|
50
|
33
|
|
|
838
|
if (!defined $version || $version < 1) { |
36
|
0
|
|
|
|
|
0
|
croak "require version number"; |
37
|
|
|
|
|
|
|
} |
38
|
165
|
|
|
|
|
1150
|
return $self->_read(sprintf '%s%d', $self->{__location}, $version); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_metadata { |
43
|
79
|
|
|
79
|
0
|
780
|
my $self = shift; |
44
|
79
|
|
|
|
|
304
|
return $self->_read(sprintf '%s%s', $self->{__location}, META_FILE); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _read { |
49
|
244
|
|
|
244
|
|
712
|
my $self = shift; |
50
|
244
|
|
|
|
|
328
|
my $path = shift; |
51
|
|
|
|
|
|
|
|
52
|
244
|
100
|
|
|
|
14809
|
open my $fh, '<', $path or croak "can't open key file: $path: $!"; |
53
|
243
|
|
|
|
|
1158
|
local $/ = undef; |
54
|
243
|
|
|
|
|
1347737
|
my $contents = <$fh>; |
55
|
243
|
|
|
|
|
3023
|
close $fh; |
56
|
243
|
|
|
|
|
2814
|
return $contents; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
__END__ |