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
|
|
110387
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
29
|
|
10
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
11
|
1
|
|
|
1
|
|
5
|
use English; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
12
|
1
|
|
|
1
|
|
423
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
13
|
1
|
|
|
1
|
|
717
|
use Data::Dumper; |
|
1
|
|
|
|
|
7223
|
|
|
1
|
|
|
|
|
65
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
570
|
use Moose; |
|
1
|
|
|
|
|
469931
|
|
|
1
|
|
|
|
|
6
|
|
16
|
|
|
|
|
|
|
extends 'Connector::Builtin'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub get { |
19
|
|
|
|
|
|
|
|
20
|
3
|
|
|
3
|
1
|
12
|
my $self = shift; |
21
|
|
|
|
|
|
|
|
22
|
3
|
|
|
|
|
7
|
my $filename = $self->{LOCATION}; |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
|
|
140
|
if (! -r $filename) { |
25
|
0
|
|
|
|
|
0
|
return $self->_node_not_exists( ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
9
|
my $content = do { |
29
|
3
|
|
|
|
|
49
|
local $INPUT_RECORD_SEPARATOR; |
30
|
3
|
|
|
|
|
110
|
open my $fh, '<', $filename; |
31
|
3
|
|
|
|
|
168
|
<$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
|
6
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
5
|
my $filename = $self->{LOCATION}; |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
42
|
return -r $filename; |
49
|
|
|
|
|
|
|
} |
50
|
1
|
|
|
1
|
|
9400
|
no Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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. |