line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
777
|
use 5.008; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
4
|
|
|
|
|
|
|
package BenchmarkAnything::Config; |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
1
|
|
|
1
|
|
305
|
$BenchmarkAnything::Config::AUTHORITY = 'cpan:SCHWIGON'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: Read BenchmarkAnything configfile |
9
|
|
|
|
|
|
|
$BenchmarkAnything::Config::VERSION = '0.003'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new |
12
|
|
|
|
|
|
|
{ |
13
|
3
|
|
|
3
|
1
|
1447
|
my $class = shift; |
14
|
3
|
|
|
|
|
10
|
my $self = bless { @_ }, $class; |
15
|
3
|
|
|
|
|
9
|
$self->_read_config; |
16
|
3
|
|
|
|
|
16
|
return $self; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _read_config |
21
|
|
|
|
|
|
|
{ |
22
|
3
|
|
|
3
|
|
5
|
my ($self) = @_; |
23
|
|
|
|
|
|
|
|
24
|
3
|
|
|
|
|
153308
|
require File::HomeDir; |
25
|
3
|
|
|
|
|
4993068
|
require YAML::Any; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# don't look into user's homedir if we are running tests |
28
|
3
|
100
|
33
|
|
|
1958
|
my $default_cfgfile = $ENV{HARNESS_ACTIVE} ? "t/benchmarkanything.cfg" : $ENV{BENCHMARKANYTHING_CONFIGFILE} || File::HomeDir->my_home . "/.benchmarkanything/default.cfg"; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# read file |
31
|
3
|
|
|
|
|
7
|
eval { |
32
|
3
|
|
66
|
|
|
55
|
$self->{cfgfile} = $self->{cfgfile} || $default_cfgfile; |
33
|
3
|
|
|
|
|
6
|
my $cfg_yaml; |
34
|
3
|
50
|
|
|
|
172
|
open (my $CFG, "<", $self->{cfgfile}) or die "Can't read: ".$self->{cfgfile}."\n"; |
35
|
|
|
|
|
|
|
{ |
36
|
3
|
|
|
|
|
6
|
local $/; |
|
3
|
|
|
|
|
18
|
|
37
|
3
|
|
|
|
|
78
|
$cfg_yaml = <$CFG>; |
38
|
|
|
|
|
|
|
} |
39
|
3
|
|
|
|
|
15
|
my $config = YAML::Any::Load($cfg_yaml); |
40
|
3
|
|
|
|
|
33280
|
$self->{benchmarkanything} = $config->{benchmarkanything}; |
41
|
|
|
|
|
|
|
}; |
42
|
3
|
50
|
|
|
|
14
|
if ($@) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
|
|
0
|
die "benchmarkanything: error loading configfile: $@\n"; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# defaults |
48
|
3
|
|
50
|
|
|
19
|
$self->{benchmarkanything}{backend} ||= 'local'; |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
6
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |