line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::From::Backend::File; |
2
|
|
|
|
|
|
|
$Config::From::Backend::File::VERSION = '0.05'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2840
|
use utf8; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
14
|
|
5
|
2
|
|
|
2
|
|
565
|
use Moose; |
|
2
|
|
|
|
|
471661
|
|
|
2
|
|
|
|
|
13
|
|
6
|
|
|
|
|
|
|
extends 'Config::From::Backend'; |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
13744
|
use Config::Any; |
|
2
|
|
|
|
|
16223
|
|
|
2
|
|
|
|
|
67
|
|
9
|
2
|
|
|
2
|
|
15
|
use Carp qw/croak/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
415
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has file => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
isa => 'Str', |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has datas => ( |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
isa => 'HashRef', |
21
|
|
|
|
|
|
|
lazy_build => 1, |
22
|
|
|
|
|
|
|
builder => '_build_datas', |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _build_datas { |
26
|
3
|
|
|
3
|
|
4
|
my $self = shift; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
99
|
my $file = $self->file; |
29
|
3
|
|
|
|
|
44
|
my $cfg = Config::Any->load_files({files => [$file], use_ext => 1 }); |
30
|
3
|
50
|
|
|
|
70745
|
croak "Can not open $file !" if ! $cfg->[0]; |
31
|
3
|
|
|
|
|
8
|
my ($filename, $config) = %{$cfg->[0]}; |
|
3
|
|
|
|
|
15
|
|
32
|
3
|
|
|
|
|
159
|
return $config; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Config::From::Backend::File - File Backend for Config::From |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 VERSION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
version 0.05 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $bckfile = Config::From::Backend::File->new(file => 't/conf/file1.yml'); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $config = $bckfile->datas |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 file |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The file to load from diffrents file format. It use Config::Any |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 datas |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
The data returned by the backend |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 SEE ALSO |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
L<Config::Any> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Daniel Brosseau, C<< <dab at catapulse.org> >> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; # End of Config::From::Backend::File |