line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::DI::Resource::YAML; |
2
|
3
|
|
|
3
|
|
124153
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
101
|
|
3
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
92
|
|
4
|
3
|
|
|
3
|
|
14103
|
use YAML qw(LoadFile); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use base qw(Class::DI::Resource); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new{ |
8
|
|
|
|
|
|
|
my $class = shift; |
9
|
|
|
|
|
|
|
my $file_path = shift; |
10
|
|
|
|
|
|
|
my $self = $class->SUPER::new; |
11
|
|
|
|
|
|
|
$self->load_resource($file_path); |
12
|
|
|
|
|
|
|
return $self; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub load_resource{ |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
my $file_path = shift; |
18
|
|
|
|
|
|
|
my $conf = LoadFile($file_path); |
19
|
|
|
|
|
|
|
foreach my $conf ( @{$conf->{injections}}){ |
20
|
|
|
|
|
|
|
$self->{_resource}->{$conf->{name}} = $conf; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
1; |