line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Connector::Builtin::File::Simple |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Proxy class for accessing simple file |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# Written by Martin Bartosch for the OpenXPKI project 2012 |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
package Connector::Builtin::File::Simple; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
103659
|
use strict; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
31
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
11
|
1
|
|
|
1
|
|
5
|
use English; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
395
|
use File::Spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
20
|
|
13
|
1
|
|
|
1
|
|
621
|
use Data::Dumper; |
|
1
|
|
|
|
|
6689
|
|
|
1
|
|
|
|
|
97
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
510
|
use Moose; |
|
1
|
|
|
|
|
442429
|
|
|
1
|
|
|
|
|
5
|
|
16
|
|
|
|
|
|
|
extends 'Connector::Builtin'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get { |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
1
|
9
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
6
|
my $filename = $self->{LOCATION}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
|
|
72
|
if (! -r $filename) { |
25
|
0
|
|
|
|
|
0
|
return $self->_node_not_exists( ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
7
|
my $content = do { |
29
|
3
|
|
|
|
|
42
|
local $INPUT_RECORD_SEPARATOR; |
30
|
3
|
|
|
|
|
103
|
open my $fh, '<', $filename; |
31
|
3
|
|
|
|
|
640
|
<$fh>; |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
21
|
return $content; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_meta { |
38
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
39
|
0
|
|
|
|
|
0
|
return { TYPE => "scalar" }; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub exists { |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
5
|
my $filename = $self->{LOCATION}; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
37
|
return -r $filename; |
49
|
|
|
|
|
|
|
} |
50
|
1
|
|
|
1
|
|
6216
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
__END__ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 Name |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Connector::Builtin::File::Simple |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 Description |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Return the contents of the file given by the LOCATION parameter. |
63
|
|
|
|
|
|
|
The path argument is discarded. |