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