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