line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Config::PL; |
2
|
3
|
|
|
3
|
|
28634
|
use 5.008001; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
216
|
|
3
|
3
|
|
|
3
|
|
26
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
129
|
|
4
|
3
|
|
|
3
|
|
30
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
181
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
15
|
use Carp (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
42
|
|
9
|
3
|
|
|
3
|
|
14
|
use Cwd (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
80
|
|
10
|
3
|
|
|
3
|
|
20
|
use File::Basename (); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
665
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw/config_do/; |
13
|
|
|
|
|
|
|
our %CONFIG; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
8
|
|
|
8
|
|
9301
|
my ($pkg, @args) = @_; |
17
|
8
|
|
|
|
|
17
|
my $caller = caller; |
18
|
|
|
|
|
|
|
|
19
|
8
|
|
|
|
|
23
|
my @export; |
20
|
8
|
100
|
|
|
|
29
|
if (@args) { |
21
|
4
|
|
100
|
|
|
37
|
push @export, shift(@args) while $args[0] && $args[0] !~ '^:'; |
22
|
4
|
|
|
|
|
11
|
my %conf = @args; |
23
|
4
|
100
|
|
|
|
16
|
$CONFIG{path} = $conf{':path'} if exists $conf{':path'}; |
24
|
|
|
|
|
|
|
} |
25
|
8
|
100
|
|
|
|
27
|
@export = @EXPORT unless @export; |
26
|
|
|
|
|
|
|
|
27
|
8
|
|
|
|
|
17
|
for my $func (@export) { |
28
|
8
|
100
|
|
|
|
15
|
Carp::croak "'$func' is not exportable function" unless grep {$_ eq $func} @EXPORT; |
|
8
|
|
|
|
|
201
|
|
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
3
|
|
18
|
no strict 'refs'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
845
|
|
31
|
7
|
|
|
|
|
17
|
*{"$caller\::$func"} = \&$func; |
|
7
|
|
|
|
|
183
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub config_do($) { |
36
|
12
|
|
|
12
|
1
|
18119
|
my $config_file = shift; |
37
|
12
|
|
|
|
|
37
|
my (undef, $file,) = caller; |
38
|
|
|
|
|
|
|
|
39
|
12
|
|
|
|
|
17
|
my $config; |
40
|
|
|
|
|
|
|
{ |
41
|
12
|
|
|
|
|
18
|
local @INC = (Cwd::getcwd, File::Basename::dirname($file)); |
|
12
|
|
|
|
|
530
|
|
42
|
12
|
100
|
|
|
|
44
|
push @INC, $CONFIG{path} if defined $CONFIG{path}; |
43
|
|
|
|
|
|
|
|
44
|
12
|
|
|
|
|
2751
|
$config = do $config_file; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
12
|
50
|
|
|
|
108
|
Carp::croak $@ if $@; |
48
|
12
|
100
|
|
|
|
323
|
Carp::croak $! unless defined $config; |
49
|
10
|
100
|
|
|
|
31
|
unless (ref $config eq 'HASH') { |
50
|
1
|
|
|
|
|
209
|
Carp::croak "$config_file does not return HashRef."; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
9
|
100
|
|
|
|
47
|
wantarray ? %$config : $config; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |