| 1 | # automatically generated file, don't edit | ||||||||||
| 2 | |||||||||||
| 3 | |||||||||||
| 4 | |||||||||||
| 5 | # Copyright 2026 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 | ▶ | use base qw(Number::Phone::StubCountry); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 2 | our $VERSION = 1.20260904101550; | |||||||||
| 26 | |||||||||||
| 27 | 2 | 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 | 2 | 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 | 4[0-8]| | ||||||||||
| 72 | [579]\\d| | ||||||||||
| 73 | 6[0-5] | ||||||||||
| 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 | 4[0-8]| | ||||||||||
| 96 | [579]\\d| | ||||||||||
| 97 | 6[0-5] | ||||||||||
| 98 | ) | ||||||||||
| 99 | )| | ||||||||||
| 100 | 58(?: | ||||||||||
| 101 | 0[1-9]| | ||||||||||
| 102 | 1[2-9] | ||||||||||
| 103 | ) | ||||||||||
| 104 | )\\d{4} | ||||||||||
| 105 | ', | ||||||||||
| 106 | 'mobile' => ' | ||||||||||
| 107 | (?: | ||||||||||
| 108 | 4(?: | ||||||||||
| 109 | 0(?: | ||||||||||
| 110 | 6[0-3]| | ||||||||||
| 111 | 9[3-6] | ||||||||||
| 112 | )| | ||||||||||
| 113 | 24[3-6]| | ||||||||||
| 114 | 44[0-35-9]| | ||||||||||
| 115 | 6(?: | ||||||||||
| 116 | 4[0-57-9]| | ||||||||||
| 117 | 6[0-6] | ||||||||||
| 118 | )| | ||||||||||
| 119 | 7(?: | ||||||||||
| 120 | 4[0-48]| | ||||||||||
| 121 | 6[0-5] | ||||||||||
| 122 | ) | ||||||||||
| 123 | )| | ||||||||||
| 124 | 5(?: | ||||||||||
| 125 | 25[3-7]| | ||||||||||
| 126 | 35[4-8]| | ||||||||||
| 127 | 73[0-6]| | ||||||||||
| 128 | 95[0-8] | ||||||||||
| 129 | )| | ||||||||||
| 130 | 6(?: | ||||||||||
| 131 | 26[013-8]| | ||||||||||
| 132 | (?: | ||||||||||
| 133 | 66| | ||||||||||
| 134 | 78 | ||||||||||
| 135 | )[0-5] | ||||||||||
| 136 | )| | ||||||||||
| 137 | 70(?: | ||||||||||
| 138 | 7[1-8]| | ||||||||||
| 139 | 8[0-8] | ||||||||||
| 140 | )| | ||||||||||
| 141 | 84(?: | ||||||||||
| 142 | 4[0-2]| | ||||||||||
| 143 | 8[0-35-9] | ||||||||||
| 144 | )| | ||||||||||
| 145 | 9(?: | ||||||||||
| 146 | 29[013-9]| | ||||||||||
| 147 | 39[014-9]| | ||||||||||
| 148 | 59[0-467]| | ||||||||||
| 149 | 899 | ||||||||||
| 150 | ) | ||||||||||
| 151 | )\\d{4}| | ||||||||||
| 152 | (?: | ||||||||||
| 153 | 4(?: | ||||||||||
| 154 | 4[0-35-9]| | ||||||||||
| 155 | 6[0-357-9]| | ||||||||||
| 156 | 7[0-35] | ||||||||||
| 157 | )| | ||||||||||
| 158 | 5(?: | ||||||||||
| 159 | [1-59][0-46-9]| | ||||||||||
| 160 | 6[0-4689]| | ||||||||||
| 161 | 7[0-246-9] | ||||||||||
| 162 | )| | ||||||||||
| 163 | 6(?: | ||||||||||
| 164 | 0[1-9]| | ||||||||||
| 165 | [13-59]\\d| | ||||||||||
| 166 | [268][0-57-9]| | ||||||||||
| 167 | 7[0-79] | ||||||||||
| 168 | )| | ||||||||||
| 169 | 70[1-59]| | ||||||||||
| 170 | 84[0-39]| | ||||||||||
| 171 | 9(?: | ||||||||||
| 172 | 0[1-9]| | ||||||||||
| 173 | 1[02-9]| | ||||||||||
| 174 | [2358][0-8]| | ||||||||||
| 175 | [467]\\d | ||||||||||
| 176 | ) | ||||||||||
| 177 | )\\d{5} | ||||||||||
| 178 | ', | ||||||||||
| 179 | 'pager' => ' | ||||||||||
| 180 | 7(?: | ||||||||||
| 181 | 1(?: | ||||||||||
| 182 | 0[0-48]| | ||||||||||
| 183 | 1[0-3679]| | ||||||||||
| 184 | 3[013]| | ||||||||||
| 185 | 69| | ||||||||||
| 186 | 9[0136] | ||||||||||
| 187 | )| | ||||||||||
| 188 | 2(?: | ||||||||||
| 189 | [02389]\\d| | ||||||||||
| 190 | 1[18]| | ||||||||||
| 191 | 7[27-9] | ||||||||||
| 192 | )| | ||||||||||
| 193 | 3(?: | ||||||||||
| 194 | [0-38]\\d| | ||||||||||
| 195 | 7[0-369]| | ||||||||||
| 196 | 9[2357-9] | ||||||||||
| 197 | )| | ||||||||||
| 198 | 47\\d| | ||||||||||
| 199 | 5(?: | ||||||||||
| 200 | [178]\\d| | ||||||||||
| 201 | 5[0-5] | ||||||||||
| 202 | )| | ||||||||||
| 203 | 6(?: | ||||||||||
| 204 | 0[0-7]| | ||||||||||
| 205 | 2[236-9]| | ||||||||||
| 206 | [35]\\d | ||||||||||
| 207 | )| | ||||||||||
| 208 | 7(?: | ||||||||||
| 209 | [27]\\d| | ||||||||||
| 210 | 8[7-9] | ||||||||||
| 211 | )| | ||||||||||
| 212 | 8(?: | ||||||||||
| 213 | [23689]\\d| | ||||||||||
| 214 | 7[1-9] | ||||||||||
| 215 | )| | ||||||||||
| 216 | 9(?: | ||||||||||
| 217 | [025]\\d| | ||||||||||
| 218 | 6[0-246-8]| | ||||||||||
| 219 | 7[0-36-9]| | ||||||||||
| 220 | 8[238] | ||||||||||
| 221 | ) | ||||||||||
| 222 | )\\d{4} | ||||||||||
| 223 | ', | ||||||||||
| 224 | 'personal_number' => ' | ||||||||||
| 225 | 8(?: | ||||||||||
| 226 | 1[0-4679]\\d| | ||||||||||
| 227 | 2(?: | ||||||||||
| 228 | [0-36]\\d| | ||||||||||
| 229 | 7[0-4] | ||||||||||
| 230 | )| | ||||||||||
| 231 | 3(?: | ||||||||||
| 232 | [034]\\d| | ||||||||||
| 233 | 2[09]| | ||||||||||
| 234 | 70 | ||||||||||
| 235 | ) | ||||||||||
| 236 | )\\d{4} | ||||||||||
| 237 | ', | ||||||||||
| 238 | 'specialrate' => '( | ||||||||||
| 239 | 900(?: | ||||||||||
| 240 | [0-24-9]\\d{7}| | ||||||||||
| 241 | 3\\d{1,4} | ||||||||||
| 242 | ) | ||||||||||
| 243 | )|( | ||||||||||
| 244 | 30(?: | ||||||||||
| 245 | 0[1-9]| | ||||||||||
| 246 | [15-7]\\d| | ||||||||||
| 247 | 2[047]| | ||||||||||
| 248 | 89 | ||||||||||
| 249 | )\\d{4} | ||||||||||
| 250 | )', | ||||||||||
| 251 | 'toll_free' => '800\\d{6}', | ||||||||||
| 252 | 'voip' => '' | ||||||||||
| 253 | }; | ||||||||||
| 254 | 2 | my $timezones = { | |||||||||
| 255 | '' => [ | ||||||||||
| 256 | 'Asia/Hong_Kong' | ||||||||||
| 257 | ] | ||||||||||
| 258 | }; | ||||||||||
| 259 | |||||||||||
| 260 | 22 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 261 | 22 | my $class = shift; | |||||||||
| 262 | 22 | my $number = shift; | |||||||||
| 263 | 22 | $number =~ s/(^\+852|\D)//g; | |||||||||
| 264 | 22 | my $self = bless({ country_code => '852', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, }, $class); | |||||||||
| 265 | 22 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 266 | } | ||||||||||
| 267 | 2 | 1; | |||||||||