line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
4
|
|
|
4
|
|
28365
|
use v5.14.0; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
147
|
|
2
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
212
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package OS::Package::Config; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Load OS::Package configuration object. |
7
|
|
|
|
|
|
|
our $VERSION = '0.2.6'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
23
|
use base qw(Exporter); |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
385
|
|
10
|
4
|
|
|
4
|
|
1986
|
use Env qw( $HOME ); |
|
4
|
|
|
|
|
5298
|
|
|
4
|
|
|
|
|
29
|
|
11
|
4
|
|
|
4
|
|
2621
|
use File::ShareDir qw(dist_file); |
|
4
|
|
|
|
|
19625
|
|
|
4
|
|
|
|
|
284
|
|
12
|
4
|
|
|
4
|
|
3827
|
use Hash::AsObject; |
|
4
|
|
|
|
|
2872
|
|
|
4
|
|
|
|
|
27
|
|
13
|
4
|
|
|
4
|
|
2556
|
use Path::Tiny; |
|
4
|
|
|
|
|
34009
|
|
|
4
|
|
|
|
|
261
|
|
14
|
4
|
|
|
4
|
|
2295
|
use YAML::Any qw( LoadFile ); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @EXPORT = qw( $OSPKG_CONFIG ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
local $YAML::UseCode = 0 if !defined $YAML::UseCode; |
19
|
|
|
|
|
|
|
local $YAML::LoadCode = 0 if !defined $YAML::LoadCode; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $OSPKG_CONFIG = Hash::AsObject->new( |
22
|
|
|
|
|
|
|
LoadFile( dist_file( 'OS-Package', 'config.yml' ) ) ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
if ( path( $OSPKG_CONFIG->user_config )->exists ) { |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $user_config = LoadFile( path( $OSPKG_CONFIG->user_config ) ); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
if ( defined $user_config->{config_dir} ) { |
29
|
|
|
|
|
|
|
$OSPKG_CONFIG->dir->configs($user_config->{config_dir}); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
if ( defined $user_config->{pkg_dir} ) { |
33
|
|
|
|
|
|
|
$OSPKG_CONFIG->dir->packages($user_config->{pkg_dir}); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__END__ |