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::HK; |
20
|
2
|
|
|
2
|
|
1268
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
248
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
40
|
use strict; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
54
|
|
23
|
2
|
|
|
2
|
|
26
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
58
|
|
24
|
2
|
|
|
2
|
|
18
|
use utf8; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
14
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230903131447; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2', |
30
|
|
|
|
|
|
|
'leading_digits' => '9003', |
31
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{2,5})' |
32
|
|
|
|
|
|
|
}, |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
'format' => '$1 $2', |
35
|
|
|
|
|
|
|
'leading_digits' => ' |
36
|
|
|
|
|
|
|
[2-7]| |
37
|
|
|
|
|
|
|
8[1-4]| |
38
|
|
|
|
|
|
|
9(?: |
39
|
|
|
|
|
|
|
0[1-9]| |
40
|
|
|
|
|
|
|
[1-8] |
41
|
|
|
|
|
|
|
) |
42
|
|
|
|
|
|
|
', |
43
|
|
|
|
|
|
|
'pattern' => '(\\d{4})(\\d{4})' |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
47
|
|
|
|
|
|
|
'leading_digits' => '8', |
48
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{3})' |
49
|
|
|
|
|
|
|
}, |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
'format' => '$1 $2 $3 $4', |
52
|
|
|
|
|
|
|
'leading_digits' => '9', |
53
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{2})(\\d{3})(\\d{3})' |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
]; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
my $validators = { |
58
|
|
|
|
|
|
|
'fixed_line' => ' |
59
|
|
|
|
|
|
|
(?: |
60
|
|
|
|
|
|
|
2(?: |
61
|
|
|
|
|
|
|
[13-9]\\d| |
62
|
|
|
|
|
|
|
2[013-9] |
63
|
|
|
|
|
|
|
)\\d| |
64
|
|
|
|
|
|
|
3(?: |
65
|
|
|
|
|
|
|
(?: |
66
|
|
|
|
|
|
|
[1569][0-24-9]| |
67
|
|
|
|
|
|
|
4[0-246-9]| |
68
|
|
|
|
|
|
|
7[0-24-69] |
69
|
|
|
|
|
|
|
)\\d| |
70
|
|
|
|
|
|
|
8(?: |
71
|
|
|
|
|
|
|
[45][0-8]| |
72
|
|
|
|
|
|
|
6[01]| |
73
|
|
|
|
|
|
|
9\\d |
74
|
|
|
|
|
|
|
) |
75
|
|
|
|
|
|
|
)| |
76
|
|
|
|
|
|
|
58(?: |
77
|
|
|
|
|
|
|
0[1-9]| |
78
|
|
|
|
|
|
|
1[2-9] |
79
|
|
|
|
|
|
|
) |
80
|
|
|
|
|
|
|
)\\d{4} |
81
|
|
|
|
|
|
|
', |
82
|
|
|
|
|
|
|
'geographic' => ' |
83
|
|
|
|
|
|
|
(?: |
84
|
|
|
|
|
|
|
2(?: |
85
|
|
|
|
|
|
|
[13-9]\\d| |
86
|
|
|
|
|
|
|
2[013-9] |
87
|
|
|
|
|
|
|
)\\d| |
88
|
|
|
|
|
|
|
3(?: |
89
|
|
|
|
|
|
|
(?: |
90
|
|
|
|
|
|
|
[1569][0-24-9]| |
91
|
|
|
|
|
|
|
4[0-246-9]| |
92
|
|
|
|
|
|
|
7[0-24-69] |
93
|
|
|
|
|
|
|
)\\d| |
94
|
|
|
|
|
|
|
8(?: |
95
|
|
|
|
|
|
|
[45][0-8]| |
96
|
|
|
|
|
|
|
6[01]| |
97
|
|
|
|
|
|
|
9\\d |
98
|
|
|
|
|
|
|
) |
99
|
|
|
|
|
|
|
)| |
100
|
|
|
|
|
|
|
58(?: |
101
|
|
|
|
|
|
|
0[1-9]| |
102
|
|
|
|
|
|
|
1[2-9] |
103
|
|
|
|
|
|
|
) |
104
|
|
|
|
|
|
|
)\\d{4} |
105
|
|
|
|
|
|
|
', |
106
|
|
|
|
|
|
|
'mobile' => ' |
107
|
|
|
|
|
|
|
(?: |
108
|
|
|
|
|
|
|
4(?: |
109
|
|
|
|
|
|
|
44[5-9]| |
110
|
|
|
|
|
|
|
6(?: |
111
|
|
|
|
|
|
|
0[0-7]| |
112
|
|
|
|
|
|
|
1[0-6]| |
113
|
|
|
|
|
|
|
4[0-57-9]| |
114
|
|
|
|
|
|
|
6[0-4]| |
115
|
|
|
|
|
|
|
7[0-8] |
116
|
|
|
|
|
|
|
) |
117
|
|
|
|
|
|
|
)| |
118
|
|
|
|
|
|
|
573[0-6]| |
119
|
|
|
|
|
|
|
6(?: |
120
|
|
|
|
|
|
|
26[013-8]| |
121
|
|
|
|
|
|
|
66[0-3] |
122
|
|
|
|
|
|
|
)| |
123
|
|
|
|
|
|
|
70(?: |
124
|
|
|
|
|
|
|
7[1-5]| |
125
|
|
|
|
|
|
|
8[0-4] |
126
|
|
|
|
|
|
|
)| |
127
|
|
|
|
|
|
|
848[015-9]| |
128
|
|
|
|
|
|
|
9(?: |
129
|
|
|
|
|
|
|
29[013-9]| |
130
|
|
|
|
|
|
|
59[0-4] |
131
|
|
|
|
|
|
|
) |
132
|
|
|
|
|
|
|
)\\d{4}| |
133
|
|
|
|
|
|
|
(?: |
134
|
|
|
|
|
|
|
4(?: |
135
|
|
|
|
|
|
|
4[01]| |
136
|
|
|
|
|
|
|
6[2358] |
137
|
|
|
|
|
|
|
)| |
138
|
|
|
|
|
|
|
5(?: |
139
|
|
|
|
|
|
|
[1-59][0-46-9]| |
140
|
|
|
|
|
|
|
6[0-4689]| |
141
|
|
|
|
|
|
|
7[0-246-9] |
142
|
|
|
|
|
|
|
)| |
143
|
|
|
|
|
|
|
6(?: |
144
|
|
|
|
|
|
|
0[1-9]| |
145
|
|
|
|
|
|
|
[13-59]\\d| |
146
|
|
|
|
|
|
|
[268][0-57-9]| |
147
|
|
|
|
|
|
|
7[0-79] |
148
|
|
|
|
|
|
|
)| |
149
|
|
|
|
|
|
|
84[09]| |
150
|
|
|
|
|
|
|
9(?: |
151
|
|
|
|
|
|
|
0[1-9]| |
152
|
|
|
|
|
|
|
1[02-9]| |
153
|
|
|
|
|
|
|
[2358][0-8]| |
154
|
|
|
|
|
|
|
[467]\\d |
155
|
|
|
|
|
|
|
) |
156
|
|
|
|
|
|
|
)\\d{5} |
157
|
|
|
|
|
|
|
', |
158
|
|
|
|
|
|
|
'pager' => ' |
159
|
|
|
|
|
|
|
7(?: |
160
|
|
|
|
|
|
|
1(?: |
161
|
|
|
|
|
|
|
0[0-38]| |
162
|
|
|
|
|
|
|
1[0-3679]| |
163
|
|
|
|
|
|
|
3[013]| |
164
|
|
|
|
|
|
|
69| |
165
|
|
|
|
|
|
|
9[0136] |
166
|
|
|
|
|
|
|
)| |
167
|
|
|
|
|
|
|
2(?: |
168
|
|
|
|
|
|
|
[02389]\\d| |
169
|
|
|
|
|
|
|
1[18]| |
170
|
|
|
|
|
|
|
7[27-9] |
171
|
|
|
|
|
|
|
)| |
172
|
|
|
|
|
|
|
3(?: |
173
|
|
|
|
|
|
|
[0-38]\\d| |
174
|
|
|
|
|
|
|
7[0-369]| |
175
|
|
|
|
|
|
|
9[2357-9] |
176
|
|
|
|
|
|
|
)| |
177
|
|
|
|
|
|
|
47\\d| |
178
|
|
|
|
|
|
|
5(?: |
179
|
|
|
|
|
|
|
[178]\\d| |
180
|
|
|
|
|
|
|
5[0-5] |
181
|
|
|
|
|
|
|
)| |
182
|
|
|
|
|
|
|
6(?: |
183
|
|
|
|
|
|
|
0[0-7]| |
184
|
|
|
|
|
|
|
2[236-9]| |
185
|
|
|
|
|
|
|
[35]\\d |
186
|
|
|
|
|
|
|
)| |
187
|
|
|
|
|
|
|
7(?: |
188
|
|
|
|
|
|
|
[27]\\d| |
189
|
|
|
|
|
|
|
8[7-9] |
190
|
|
|
|
|
|
|
)| |
191
|
|
|
|
|
|
|
8(?: |
192
|
|
|
|
|
|
|
[23689]\\d| |
193
|
|
|
|
|
|
|
7[1-9] |
194
|
|
|
|
|
|
|
)| |
195
|
|
|
|
|
|
|
9(?: |
196
|
|
|
|
|
|
|
[025]\\d| |
197
|
|
|
|
|
|
|
6[0-246-8]| |
198
|
|
|
|
|
|
|
7[0-36-9]| |
199
|
|
|
|
|
|
|
8[238] |
200
|
|
|
|
|
|
|
) |
201
|
|
|
|
|
|
|
)\\d{4} |
202
|
|
|
|
|
|
|
', |
203
|
|
|
|
|
|
|
'personal_number' => ' |
204
|
|
|
|
|
|
|
8(?: |
205
|
|
|
|
|
|
|
1[0-4679]\\d| |
206
|
|
|
|
|
|
|
2(?: |
207
|
|
|
|
|
|
|
[0-36]\\d| |
208
|
|
|
|
|
|
|
7[0-4] |
209
|
|
|
|
|
|
|
)| |
210
|
|
|
|
|
|
|
3(?: |
211
|
|
|
|
|
|
|
[034]\\d| |
212
|
|
|
|
|
|
|
2[09]| |
213
|
|
|
|
|
|
|
70 |
214
|
|
|
|
|
|
|
) |
215
|
|
|
|
|
|
|
)\\d{4} |
216
|
|
|
|
|
|
|
', |
217
|
|
|
|
|
|
|
'specialrate' => '( |
218
|
|
|
|
|
|
|
900(?: |
219
|
|
|
|
|
|
|
[0-24-9]\\d{7}| |
220
|
|
|
|
|
|
|
3\\d{1,4} |
221
|
|
|
|
|
|
|
) |
222
|
|
|
|
|
|
|
)|( |
223
|
|
|
|
|
|
|
30(?: |
224
|
|
|
|
|
|
|
0[1-9]| |
225
|
|
|
|
|
|
|
[15-7]\\d| |
226
|
|
|
|
|
|
|
2[047]| |
227
|
|
|
|
|
|
|
89 |
228
|
|
|
|
|
|
|
)\\d{4} |
229
|
|
|
|
|
|
|
)', |
230
|
|
|
|
|
|
|
'toll_free' => '800\\d{6}', |
231
|
|
|
|
|
|
|
'voip' => '' |
232
|
|
|
|
|
|
|
}; |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
sub new { |
235
|
22
|
|
|
22
|
1
|
69
|
my $class = shift; |
236
|
22
|
|
|
|
|
53
|
my $number = shift; |
237
|
22
|
|
|
|
|
150
|
$number =~ s/(^\+852|\D)//g; |
238
|
22
|
|
|
|
|
167
|
my $self = bless({ country_code => '852', number => $number, formatters => $formatters, validators => $validators, }, $class); |
239
|
22
|
100
|
|
|
|
102
|
return $self->is_valid() ? $self : undef; |
240
|
|
|
|
|
|
|
} |
241
|
|
|
|
|
|
|
1; |