line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Benchmark::Featureset::SetOps::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
4
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
393
|
use Config::Tiny; |
|
1
|
|
|
|
|
720
|
|
|
1
|
|
|
|
|
22
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
401
|
use File::HomeDir; |
|
1
|
|
|
|
|
3730
|
|
|
1
|
|
|
|
|
39
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
442
|
use Moo; |
|
1
|
|
|
|
|
8102
|
|
|
1
|
|
|
|
|
3
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
1501
|
use Path::Class; |
|
1
|
|
|
|
|
28566
|
|
|
1
|
|
|
|
|
47
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
489
|
use Types::Standard qw/Any Str/; |
|
1
|
|
|
|
|
45427
|
|
|
1
|
|
|
|
|
7
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has config => |
17
|
|
|
|
|
|
|
( |
18
|
|
|
|
|
|
|
default => sub{return {} }, |
19
|
|
|
|
|
|
|
is => 'rw', |
20
|
|
|
|
|
|
|
isa => Any, |
21
|
|
|
|
|
|
|
required => 0, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has config_file_path => |
25
|
|
|
|
|
|
|
( |
26
|
|
|
|
|
|
|
default => sub{return ''}, |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
isa => Any, |
29
|
|
|
|
|
|
|
required => 0, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has section => |
33
|
|
|
|
|
|
|
( |
34
|
|
|
|
|
|
|
default => sub{return ''}, |
35
|
|
|
|
|
|
|
is => 'rw', |
36
|
|
|
|
|
|
|
isa => Str, |
37
|
|
|
|
|
|
|
required => 0, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
our $VERSION = '1.05'; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# ----------------------------------------------- |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub BUILD |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
0
|
0
|
|
my($self) = @_; |
47
|
0
|
|
|
|
|
|
my($path) = Path::Class::file(File::HomeDir -> my_dist_config('Benchmark-Featureset-SetOps'), '.htbenchmark.featureset.setops.conf'); |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
$self -> read($path); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} # End of BUILD. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# ----------------------------------------------- |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub read |
56
|
|
|
|
|
|
|
{ |
57
|
0
|
|
|
0
|
1
|
|
my($self, $path) = @_; |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self -> config_file_path($path); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# Check [global]. |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$self -> config(Config::Tiny -> read($path) ); |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
if (Config::Tiny -> errstr) |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
|
|
|
die Config::Tiny -> errstr; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
$self -> section('global'); |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
if (! ${$self -> config}{$self -> section}) |
|
0
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
{ |
74
|
0
|
|
|
|
|
|
die "Config file '$path' does not contain the section [@{[$self -> section]}]\n"; |
|
0
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# Check [x] where x is host=x within [global]. |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$self -> section(${$self -> config}{$self -> section}{'host'}); |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if (! ${$self -> config}{$self -> section}) |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
{ |
83
|
0
|
|
|
|
|
|
die "Config file '$path' does not contain the section [@{[$self -> section]}]\n"; |
|
0
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Move desired section into config, so caller can just use $self -> config to get a hashref. |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
$self -> config(${$self -> config}{$self -> section}); |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
} # End of read. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# -------------------------------------------------- |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=pod |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 NAME |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Benchmark::Featureset::SetOps::Config - Compare various array/set handling modules |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 Synopsis |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
See L. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 Description |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L compares verious array/set handling modules. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 Methods |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 init() |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
For use by subclasses. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Sets default values for object attributes. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 new() |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
For use by subclasses. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 read() |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
read() is called by new(). It does the actual reading of the config file. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
If the file can't be read, die is called. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
The path to the config file is determined by: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Path::Class::file(File::HomeDir -> my_dist_config('Benchmark-Featureset-SetOps'), '.htbenchmark.featureset.setops.conf'); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
During installation, you should have run scripts/copy.config.pl, which uses the same code, to move the config file |
133
|
|
|
|
|
|
|
from the config/ directory in the disto into an OS-dependent directory. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
The run-time code uses this module to look in the same directory as used by scripts/copy.config.pl. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 Repository |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 Support |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Email the author, or log a bug on RT: |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 Author |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L was written by Ron Savage Iron@savage.net.auE> in 2012. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Home page: L. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 Copyright |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Australian copyright (c) 2012, Ron Savage. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
All Programs of mine are 'OSI Certified Open Source Software'; |
158
|
|
|
|
|
|
|
you can redistribute them and/or modify them under the terms of |
159
|
|
|
|
|
|
|
The Artistic License, a copy of which is available at: |
160
|
|
|
|
|
|
|
http://www.opensource.org/licenses/index.html |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=cut |