line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# automatically generated file, don't edit |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Copyright 2023 David Cantrell, derived from data from libphonenumber |
6
|
|
|
|
|
|
|
# http://code.google.com/p/libphonenumber/ |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); |
9
|
|
|
|
|
|
|
# you may not use this file except in compliance with the License. |
10
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, software |
15
|
|
|
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, |
16
|
|
|
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17
|
|
|
|
|
|
|
# See the License for the specific language governing permissions and |
18
|
|
|
|
|
|
|
# limitations under the License. |
19
|
|
|
|
|
|
|
package Number::Phone::StubCountry::BW; |
20
|
2
|
|
|
2
|
|
1065
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
261
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
15
|
use strict; |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
42
|
|
23
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
50
|
|
24
|
2
|
|
|
2
|
|
12
|
use utf8; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
13
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230307181417; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
30
|
|
|
|
|
|
|
'leading_digits' => '90', |
31
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{5})' |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
'format' => '$1 $2', |
35
|
|
|
|
|
|
|
'leading_digits' => ' |
36
|
|
|
|
|
|
|
[24-6]| |
37
|
|
|
|
|
|
|
3[15-79] |
38
|
|
|
|
|
|
|
', |
39
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})' |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
{ |
42
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
43
|
|
|
|
|
|
|
'leading_digits' => '[37]', |
44
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{3})' |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
{ |
47
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
48
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{3})(\\d{3})' |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
52
|
|
|
|
|
|
|
'leading_digits' => '8', |
53
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{4})(\\d{3})' |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
]; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $validators = { |
58
|
|
|
|
|
|
|
'fixed_line' => ' |
59
|
|
|
|
|
|
|
(?: |
60
|
|
|
|
|
|
|
2(?: |
61
|
|
|
|
|
|
|
4[0-48]| |
62
|
|
|
|
|
|
|
6[0-24]| |
63
|
|
|
|
|
|
|
9[0578] |
64
|
|
|
|
|
|
|
)| |
65
|
|
|
|
|
|
|
3(?: |
66
|
|
|
|
|
|
|
1[0-35-9]| |
67
|
|
|
|
|
|
|
55| |
68
|
|
|
|
|
|
|
[69]\\d| |
69
|
|
|
|
|
|
|
7[013] |
70
|
|
|
|
|
|
|
)| |
71
|
|
|
|
|
|
|
4(?: |
72
|
|
|
|
|
|
|
6[03]| |
73
|
|
|
|
|
|
|
7[1267]| |
74
|
|
|
|
|
|
|
9[0-5] |
75
|
|
|
|
|
|
|
)| |
76
|
|
|
|
|
|
|
5(?: |
77
|
|
|
|
|
|
|
3[03489]| |
78
|
|
|
|
|
|
|
4[0489]| |
79
|
|
|
|
|
|
|
7[1-47]| |
80
|
|
|
|
|
|
|
88| |
81
|
|
|
|
|
|
|
9[0-49] |
82
|
|
|
|
|
|
|
)| |
83
|
|
|
|
|
|
|
6(?: |
84
|
|
|
|
|
|
|
2[1-35]| |
85
|
|
|
|
|
|
|
5[149]| |
86
|
|
|
|
|
|
|
8[067] |
87
|
|
|
|
|
|
|
) |
88
|
|
|
|
|
|
|
)\\d{4} |
89
|
|
|
|
|
|
|
', |
90
|
|
|
|
|
|
|
'geographic' => ' |
91
|
|
|
|
|
|
|
(?: |
92
|
|
|
|
|
|
|
2(?: |
93
|
|
|
|
|
|
|
4[0-48]| |
94
|
|
|
|
|
|
|
6[0-24]| |
95
|
|
|
|
|
|
|
9[0578] |
96
|
|
|
|
|
|
|
)| |
97
|
|
|
|
|
|
|
3(?: |
98
|
|
|
|
|
|
|
1[0-35-9]| |
99
|
|
|
|
|
|
|
55| |
100
|
|
|
|
|
|
|
[69]\\d| |
101
|
|
|
|
|
|
|
7[013] |
102
|
|
|
|
|
|
|
)| |
103
|
|
|
|
|
|
|
4(?: |
104
|
|
|
|
|
|
|
6[03]| |
105
|
|
|
|
|
|
|
7[1267]| |
106
|
|
|
|
|
|
|
9[0-5] |
107
|
|
|
|
|
|
|
)| |
108
|
|
|
|
|
|
|
5(?: |
109
|
|
|
|
|
|
|
3[03489]| |
110
|
|
|
|
|
|
|
4[0489]| |
111
|
|
|
|
|
|
|
7[1-47]| |
112
|
|
|
|
|
|
|
88| |
113
|
|
|
|
|
|
|
9[0-49] |
114
|
|
|
|
|
|
|
)| |
115
|
|
|
|
|
|
|
6(?: |
116
|
|
|
|
|
|
|
2[1-35]| |
117
|
|
|
|
|
|
|
5[149]| |
118
|
|
|
|
|
|
|
8[067] |
119
|
|
|
|
|
|
|
) |
120
|
|
|
|
|
|
|
)\\d{4} |
121
|
|
|
|
|
|
|
', |
122
|
|
|
|
|
|
|
'mobile' => ' |
123
|
|
|
|
|
|
|
(?: |
124
|
|
|
|
|
|
|
321| |
125
|
|
|
|
|
|
|
7(?: |
126
|
|
|
|
|
|
|
[1-7]\\d| |
127
|
|
|
|
|
|
|
8[0-4] |
128
|
|
|
|
|
|
|
) |
129
|
|
|
|
|
|
|
)\\d{5} |
130
|
|
|
|
|
|
|
', |
131
|
|
|
|
|
|
|
'pager' => '', |
132
|
|
|
|
|
|
|
'personal_number' => '', |
133
|
|
|
|
|
|
|
'specialrate' => '(90\\d{5})', |
134
|
|
|
|
|
|
|
'toll_free' => ' |
135
|
|
|
|
|
|
|
(?: |
136
|
|
|
|
|
|
|
0800| |
137
|
|
|
|
|
|
|
800\\d |
138
|
|
|
|
|
|
|
)\\d{6} |
139
|
|
|
|
|
|
|
', |
140
|
|
|
|
|
|
|
'voip' => ' |
141
|
|
|
|
|
|
|
79(?: |
142
|
|
|
|
|
|
|
1(?: |
143
|
|
|
|
|
|
|
[01]\\d| |
144
|
|
|
|
|
|
|
2[0-7] |
145
|
|
|
|
|
|
|
)| |
146
|
|
|
|
|
|
|
2[0-7]\\d |
147
|
|
|
|
|
|
|
)\\d{3} |
148
|
|
|
|
|
|
|
' |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
my %areanames = (); |
151
|
|
|
|
|
|
|
$areanames{en} = {"267530", "Lobatse", |
152
|
|
|
|
|
|
|
"267534", "Lobatse", |
153
|
|
|
|
|
|
|
"267397", "Gaborone", |
154
|
|
|
|
|
|
|
"267392", "Gaborone", |
155
|
|
|
|
|
|
|
"26754", "Barolong\/Ngwaketse", |
156
|
|
|
|
|
|
|
"267393", "Gaborone", |
157
|
|
|
|
|
|
|
"26759", "Molepolole", |
158
|
|
|
|
|
|
|
"267659", "Gantsi", |
159
|
|
|
|
|
|
|
"267370", "Gaborone", |
160
|
|
|
|
|
|
|
"26735", "Gaborone", |
161
|
|
|
|
|
|
|
"267651", "Kgalagadi", |
162
|
|
|
|
|
|
|
"26749", "Palapye", |
163
|
|
|
|
|
|
|
"267395", "Gaborone", |
164
|
|
|
|
|
|
|
"267391", "Gaborone", |
165
|
|
|
|
|
|
|
"26746", "Serowe", |
166
|
|
|
|
|
|
|
"267310", "Gaborone\ \(outer\)", |
167
|
|
|
|
|
|
|
"267316", "Gaborone", |
168
|
|
|
|
|
|
|
"267313", "Gaborone", |
169
|
|
|
|
|
|
|
"267318", "Gaborone", |
170
|
|
|
|
|
|
|
"267539", "Ramotswa", |
171
|
|
|
|
|
|
|
"267312", "Gaborone", |
172
|
|
|
|
|
|
|
"267317", "Gaborone", |
173
|
|
|
|
|
|
|
"26726", "Selebi\-Phikwe", |
174
|
|
|
|
|
|
|
"26758", "Jwaneng", |
175
|
|
|
|
|
|
|
"267315", "Gaborone", |
176
|
|
|
|
|
|
|
"267371", "Gaborone", |
177
|
|
|
|
|
|
|
"267654", "Kgalagadi", |
178
|
|
|
|
|
|
|
"26757", "Mochudi", |
179
|
|
|
|
|
|
|
"26768", "Maun", |
180
|
|
|
|
|
|
|
"26729", "Letlhakane\/Orapa", |
181
|
|
|
|
|
|
|
"267533", "Lobatse", |
182
|
|
|
|
|
|
|
"26762", "Kasane", |
183
|
|
|
|
|
|
|
"267319", "Gaborone", |
184
|
|
|
|
|
|
|
"26736", "Gaborone", |
185
|
|
|
|
|
|
|
"267394", "Gaborone", |
186
|
|
|
|
|
|
|
"26724", "Francistown", |
187
|
|
|
|
|
|
|
"267390", "Gaborone", |
188
|
|
|
|
|
|
|
"26747", "Mahalapye", |
189
|
|
|
|
|
|
|
"267538", "Ramotswa",}; |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub new { |
192
|
16
|
|
|
16
|
1
|
35
|
my $class = shift; |
193
|
16
|
|
|
|
|
26
|
my $number = shift; |
194
|
16
|
|
|
|
|
96
|
$number =~ s/(^\+267|\D)//g; |
195
|
16
|
|
|
|
|
89
|
my $self = bless({ country_code => '267', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
196
|
16
|
100
|
|
|
|
76
|
return $self->is_valid() ? $self : undef; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
1; |