| 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::ZA; |
|
20
|
2
|
|
|
2
|
|
1297
|
use base qw(Number::Phone::StubCountry); |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
234
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
16
|
use strict; |
|
|
2
|
|
|
|
|
8
|
|
|
|
2
|
|
|
|
|
57
|
|
|
23
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
70
|
|
|
24
|
2
|
|
|
2
|
|
23
|
use utf8; |
|
|
2
|
|
|
|
|
7
|
|
|
|
2
|
|
|
|
|
14
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230307181423; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
|
28
|
|
|
|
|
|
|
{ |
|
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
|
30
|
|
|
|
|
|
|
'leading_digits' => '8[1-4]', |
|
31
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
32
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3,4})' |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
{ |
|
35
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
|
36
|
|
|
|
|
|
|
'leading_digits' => '8[1-4]', |
|
37
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
38
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{2,3})' |
|
39
|
|
|
|
|
|
|
}, |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
|
42
|
|
|
|
|
|
|
'leading_digits' => '860', |
|
43
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
44
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{3})' |
|
45
|
|
|
|
|
|
|
}, |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
|
48
|
|
|
|
|
|
|
'leading_digits' => '[1-9]', |
|
49
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
50
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{4})' |
|
51
|
|
|
|
|
|
|
}, |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
|
54
|
|
|
|
|
|
|
'leading_digits' => '8', |
|
55
|
|
|
|
|
|
|
'national_rule' => '0$1', |
|
56
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{4})' |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
]; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my $validators = { |
|
61
|
|
|
|
|
|
|
'fixed_line' => ' |
|
62
|
|
|
|
|
|
|
(?: |
|
63
|
|
|
|
|
|
|
2(?: |
|
64
|
|
|
|
|
|
|
0330| |
|
65
|
|
|
|
|
|
|
4302 |
|
66
|
|
|
|
|
|
|
)| |
|
67
|
|
|
|
|
|
|
52087 |
|
68
|
|
|
|
|
|
|
)0\\d{3}| |
|
69
|
|
|
|
|
|
|
(?: |
|
70
|
|
|
|
|
|
|
1[0-8]| |
|
71
|
|
|
|
|
|
|
2[1-378]| |
|
72
|
|
|
|
|
|
|
3[1-69]| |
|
73
|
|
|
|
|
|
|
4\\d| |
|
74
|
|
|
|
|
|
|
5[1346-8] |
|
75
|
|
|
|
|
|
|
)\\d{7} |
|
76
|
|
|
|
|
|
|
', |
|
77
|
|
|
|
|
|
|
'geographic' => ' |
|
78
|
|
|
|
|
|
|
(?: |
|
79
|
|
|
|
|
|
|
2(?: |
|
80
|
|
|
|
|
|
|
0330| |
|
81
|
|
|
|
|
|
|
4302 |
|
82
|
|
|
|
|
|
|
)| |
|
83
|
|
|
|
|
|
|
52087 |
|
84
|
|
|
|
|
|
|
)0\\d{3}| |
|
85
|
|
|
|
|
|
|
(?: |
|
86
|
|
|
|
|
|
|
1[0-8]| |
|
87
|
|
|
|
|
|
|
2[1-378]| |
|
88
|
|
|
|
|
|
|
3[1-69]| |
|
89
|
|
|
|
|
|
|
4\\d| |
|
90
|
|
|
|
|
|
|
5[1346-8] |
|
91
|
|
|
|
|
|
|
)\\d{7} |
|
92
|
|
|
|
|
|
|
', |
|
93
|
|
|
|
|
|
|
'mobile' => ' |
|
94
|
|
|
|
|
|
|
(?: |
|
95
|
|
|
|
|
|
|
1(?: |
|
96
|
|
|
|
|
|
|
3492[0-25]| |
|
97
|
|
|
|
|
|
|
4495[0235]| |
|
98
|
|
|
|
|
|
|
549(?: |
|
99
|
|
|
|
|
|
|
20| |
|
100
|
|
|
|
|
|
|
5[01] |
|
101
|
|
|
|
|
|
|
) |
|
102
|
|
|
|
|
|
|
)| |
|
103
|
|
|
|
|
|
|
4[34]492[01] |
|
104
|
|
|
|
|
|
|
)\\d{3}| |
|
105
|
|
|
|
|
|
|
8[1-4]\\d{3,7}| |
|
106
|
|
|
|
|
|
|
(?: |
|
107
|
|
|
|
|
|
|
2[27]| |
|
108
|
|
|
|
|
|
|
47| |
|
109
|
|
|
|
|
|
|
54 |
|
110
|
|
|
|
|
|
|
)4950\\d{3}| |
|
111
|
|
|
|
|
|
|
(?: |
|
112
|
|
|
|
|
|
|
1(?: |
|
113
|
|
|
|
|
|
|
049[2-4]| |
|
114
|
|
|
|
|
|
|
9[12]\\d\\d |
|
115
|
|
|
|
|
|
|
)| |
|
116
|
|
|
|
|
|
|
(?: |
|
117
|
|
|
|
|
|
|
6\\d| |
|
118
|
|
|
|
|
|
|
7[0-46-9] |
|
119
|
|
|
|
|
|
|
)\\d{3}| |
|
120
|
|
|
|
|
|
|
8(?: |
|
121
|
|
|
|
|
|
|
5\\d{3}| |
|
122
|
|
|
|
|
|
|
7(?: |
|
123
|
|
|
|
|
|
|
08[67]| |
|
124
|
|
|
|
|
|
|
158| |
|
125
|
|
|
|
|
|
|
28[5-9]| |
|
126
|
|
|
|
|
|
|
310 |
|
127
|
|
|
|
|
|
|
) |
|
128
|
|
|
|
|
|
|
) |
|
129
|
|
|
|
|
|
|
)\\d{4}| |
|
130
|
|
|
|
|
|
|
(?: |
|
131
|
|
|
|
|
|
|
1[6-8]| |
|
132
|
|
|
|
|
|
|
28| |
|
133
|
|
|
|
|
|
|
3[2-69]| |
|
134
|
|
|
|
|
|
|
4[025689]| |
|
135
|
|
|
|
|
|
|
5[36-8] |
|
136
|
|
|
|
|
|
|
)4920\\d{3}| |
|
137
|
|
|
|
|
|
|
(?: |
|
138
|
|
|
|
|
|
|
12| |
|
139
|
|
|
|
|
|
|
[2-5]1 |
|
140
|
|
|
|
|
|
|
)492\\d{4} |
|
141
|
|
|
|
|
|
|
', |
|
142
|
|
|
|
|
|
|
'pager' => '', |
|
143
|
|
|
|
|
|
|
'personal_number' => '', |
|
144
|
|
|
|
|
|
|
'specialrate' => '(860\\d{6})|( |
|
145
|
|
|
|
|
|
|
(?: |
|
146
|
|
|
|
|
|
|
86[2-9]| |
|
147
|
|
|
|
|
|
|
9[0-2]\\d |
|
148
|
|
|
|
|
|
|
)\\d{6} |
|
149
|
|
|
|
|
|
|
)|(861\\d{6,7})', |
|
150
|
|
|
|
|
|
|
'toll_free' => '80\\d{7}', |
|
151
|
|
|
|
|
|
|
'voip' => ' |
|
152
|
|
|
|
|
|
|
87(?: |
|
153
|
|
|
|
|
|
|
08[0-589]| |
|
154
|
|
|
|
|
|
|
15[0-79]| |
|
155
|
|
|
|
|
|
|
28[0-4]| |
|
156
|
|
|
|
|
|
|
31[1-9] |
|
157
|
|
|
|
|
|
|
)\\d{4}| |
|
158
|
|
|
|
|
|
|
87(?: |
|
159
|
|
|
|
|
|
|
[02][0-79]| |
|
160
|
|
|
|
|
|
|
1[0-46-9]| |
|
161
|
|
|
|
|
|
|
3[02-9]| |
|
162
|
|
|
|
|
|
|
[4-9]\\d |
|
163
|
|
|
|
|
|
|
)\\d{5} |
|
164
|
|
|
|
|
|
|
' |
|
165
|
|
|
|
|
|
|
}; |
|
166
|
|
|
|
|
|
|
my %areanames = (); |
|
167
|
|
|
|
|
|
|
$areanames{en} = {"2757", "Northern\ Free\ State\ Goldfields\/Welkom", |
|
168
|
|
|
|
|
|
|
"2735", "Richards\ Bay\/St\.\ Lucia\/Ulundi\/Zululand", |
|
169
|
|
|
|
|
|
|
"2739", "Eastern\ Pondoland\/Port\ Shepstone\/Southern\ coast\ of\ KwaZulu\ Natal", |
|
170
|
|
|
|
|
|
|
"2722", "Boland\/Malmesbury\/Vredenburg\/Western\ coast\ of\ Western\ Cape", |
|
171
|
|
|
|
|
|
|
"2753", "Eastern\ part\ of\ Northern\ Cape\/Far\ western\ part\ of\ North\ West\/Kimberley\/Kuruman", |
|
172
|
|
|
|
|
|
|
"2712", "Brits\/Tshwane", |
|
173
|
|
|
|
|
|
|
"2734", "Newcastle\/Northern\ KwaZulu\ Natal\/Vryheid", |
|
174
|
|
|
|
|
|
|
"2742", "Jeffreys\ Bay\/Humansdorp\/Southern\ and\ central\ Eastern\ Cape", |
|
175
|
|
|
|
|
|
|
"2747", "Butterworth\/Eastern\ part\ of\ Eastern\ Cape\/Mthatha", |
|
176
|
|
|
|
|
|
|
"2731", "Durban", |
|
177
|
|
|
|
|
|
|
"2717", "Ermelo\/Secunda\/Southern\ Mpumalanga", |
|
178
|
|
|
|
|
|
|
"2727", "Alexander\ Bay\/Calvinia\/Clanwilliam\/Namaqualand\/Port\ Nolloth\/Springbok\/Vredendal", |
|
179
|
|
|
|
|
|
|
"2743", "East\ London", |
|
180
|
|
|
|
|
|
|
"2740", "Alice\/Bhisho", |
|
181
|
|
|
|
|
|
|
"2736", "Drakensberg\/Ladysmith", |
|
182
|
|
|
|
|
|
|
"2723", "Beaufort\ West\/Karoo\/Robertson\/Worcester", |
|
183
|
|
|
|
|
|
|
"2710", "Johannesburg", |
|
184
|
|
|
|
|
|
|
"2713", "Bronkhorstspruit\/Eastern\ Gauteng\/Middelburg\/Nelspruit\/Northern\ and\ Western\ Mpumalanga\/Witbank", |
|
185
|
|
|
|
|
|
|
"2711", "Johannesburg", |
|
186
|
|
|
|
|
|
|
"2721", "Cape\ Town\/Gordons\ Bay\/Somerset\ West\/Stellenbosch", |
|
187
|
|
|
|
|
|
|
"2741", "Port\ Elizabeth\/Uitenhage", |
|
188
|
|
|
|
|
|
|
"2716", "Vaal\ Triangle", |
|
189
|
|
|
|
|
|
|
"2733", "KwaZulu\ Natal\ Midlands\/Pietermaritzburg", |
|
190
|
|
|
|
|
|
|
"2746", "Bathurst\/Southern\ and\ eastern\ parts\ of\ Eastern\ Cape\/Grahamstown\/Kenton\-on\-Sea\/Port\ Alfred", |
|
191
|
|
|
|
|
|
|
"2754", "Upington\/Gordonia", |
|
192
|
|
|
|
|
|
|
"2758", "Bethlehem\/Eastern\ Free\ State", |
|
193
|
|
|
|
|
|
|
"2745", "Northern\ and\ eastern\ parts\ of\ Eastern\ Cape\/Queenstown", |
|
194
|
|
|
|
|
|
|
"2749", "Graaff\-Reinet\/Western\ part\ of\ Eastern\ Cape", |
|
195
|
|
|
|
|
|
|
"2751", "Aliwal\ North\/Bloemfontein\/Far\ eastern\ part\ of\ Eastern\ Cape\/Southern\ and\ Central\ Free\ State", |
|
196
|
|
|
|
|
|
|
"2715", "Northern\ and\ Eastern\ Limpopo\/Polokwane", |
|
197
|
|
|
|
|
|
|
"2714", "Modimolle\/Northern\ North\ West\ and\ Southwestern\ Limpopo\/Rustenburg", |
|
198
|
|
|
|
|
|
|
"2728", "Caledon\/Hermanus\/Southern\ coast\ of\ Western\ Cape\/Swellendam", |
|
199
|
|
|
|
|
|
|
"2718", "Klerksdorp\/Lichtenburg\/Potchefstroom", |
|
200
|
|
|
|
|
|
|
"2744", "Garden\ Route\/George\/Knysna\/Mossel\ Bay\/Oudtshoorn\/Plettenberg\ Bay", |
|
201
|
|
|
|
|
|
|
"2756", "Kroonstad\/Parys\/Northern\ Free\ State", |
|
202
|
|
|
|
|
|
|
"2748", "Cradock\/Northern\ part\ of\ Eastern\ Cape\/Steynsburg", |
|
203
|
|
|
|
|
|
|
"2732", "Ballito\/KwaZulu\ Natal\ coast\/Stanger\/Tongaat\/Verulam",}; |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub new { |
|
206
|
22
|
|
|
22
|
1
|
57
|
my $class = shift; |
|
207
|
22
|
|
|
|
|
47
|
my $number = shift; |
|
208
|
22
|
|
|
|
|
168
|
$number =~ s/(^\+27|\D)//g; |
|
209
|
22
|
|
|
|
|
155
|
my $self = bless({ country_code => '27', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
|
210
|
22
|
100
|
|
|
|
113
|
return $self if ($self->is_valid()); |
|
211
|
1
|
|
|
|
|
3
|
$number =~ s/^(?:0)//; |
|
212
|
1
|
|
|
|
|
12
|
$self = bless({ country_code => '27', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
|
213
|
1
|
50
|
|
|
|
6
|
return $self->is_valid() ? $self : undef; |
|
214
|
|
|
|
|
|
|
} |
|
215
|
|
|
|
|
|
|
1; |