| 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::TW; | ||||||||||
| 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.20260904101551; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2 $3', | ||||||||||
| 30 | 'leading_digits' => '202', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d{2})(\\d)(\\d{4})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2', | ||||||||||
| 36 | 'leading_digits' => '826', | ||||||||||
| 37 | 'national_rule' => '0$1', | ||||||||||
| 38 | 'pattern' => '(\\d{3})(\\d{5})' | ||||||||||
| 39 | }, | ||||||||||
| 40 | { | ||||||||||
| 41 | 'format' => '$1 $2 $3', | ||||||||||
| 42 | 'leading_digits' => '83', | ||||||||||
| 43 | 'national_rule' => '0$1', | ||||||||||
| 44 | 'pattern' => '(\\d{3})(\\d{2})(\\d{3})' | ||||||||||
| 45 | }, | ||||||||||
| 46 | { | ||||||||||
| 47 | 'format' => '$1 $2 $3', | ||||||||||
| 48 | 'leading_digits' => '82', | ||||||||||
| 49 | 'national_rule' => '0$1', | ||||||||||
| 50 | 'pattern' => '(\\d{2})(\\d{2})(\\d{4})' | ||||||||||
| 51 | }, | ||||||||||
| 52 | { | ||||||||||
| 53 | 'format' => '$1 $2 $3', | ||||||||||
| 54 | 'leading_digits' => ' | ||||||||||
| 55 | [25]0| | ||||||||||
| 56 | 37| | ||||||||||
| 57 | 49| | ||||||||||
| 58 | 8[09] | ||||||||||
| 59 | ', | ||||||||||
| 60 | 'national_rule' => '0$1', | ||||||||||
| 61 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})' | ||||||||||
| 62 | }, | ||||||||||
| 63 | { | ||||||||||
| 64 | 'format' => '$1 $2 $3', | ||||||||||
| 65 | 'leading_digits' => ' | ||||||||||
| 66 | [23568]| | ||||||||||
| 67 | 4(?: | ||||||||||
| 68 | 0[2-48]| | ||||||||||
| 69 | [1-478] | ||||||||||
| 70 | )| | ||||||||||
| 71 | (?: | ||||||||||
| 72 | 400| | ||||||||||
| 73 | 7 | ||||||||||
| 74 | )[1-9] | ||||||||||
| 75 | ', | ||||||||||
| 76 | 'national_rule' => '0$1', | ||||||||||
| 77 | 'pattern' => '(\\d)(\\d{3,4})(\\d{4})' | ||||||||||
| 78 | }, | ||||||||||
| 79 | { | ||||||||||
| 80 | 'format' => '$1 $2 $3', | ||||||||||
| 81 | 'leading_digits' => '[49]', | ||||||||||
| 82 | 'national_rule' => '0$1', | ||||||||||
| 83 | 'pattern' => '(\\d{3})(\\d{3})(\\d{3})' | ||||||||||
| 84 | }, | ||||||||||
| 85 | { | ||||||||||
| 86 | 'format' => '$1 $2 $3', | ||||||||||
| 87 | 'leading_digits' => '7', | ||||||||||
| 88 | 'national_rule' => '0$1', | ||||||||||
| 89 | 'pattern' => '(\\d{2})(\\d{4})(\\d{4,5})' | ||||||||||
| 90 | } | ||||||||||
| 91 | ]; | ||||||||||
| 92 | |||||||||||
| 93 | 2 | my $validators = { | |||||||||
| 94 | 'fixed_line' => ' | ||||||||||
| 95 | (?: | ||||||||||
| 96 | 2[2-8]\\d| | ||||||||||
| 97 | 370| | ||||||||||
| 98 | 55[01]| | ||||||||||
| 99 | 7[1-9] | ||||||||||
| 100 | )\\d{6}| | ||||||||||
| 101 | 4(?: | ||||||||||
| 102 | (?: | ||||||||||
| 103 | 0(?: | ||||||||||
| 104 | 0[1-9]| | ||||||||||
| 105 | [2-48]\\d | ||||||||||
| 106 | )| | ||||||||||
| 107 | 1[023]\\d | ||||||||||
| 108 | )\\d{4,5}| | ||||||||||
| 109 | (?: | ||||||||||
| 110 | [239]\\d\\d| | ||||||||||
| 111 | 4(?: | ||||||||||
| 112 | 0[56]| | ||||||||||
| 113 | 12| | ||||||||||
| 114 | 49 | ||||||||||
| 115 | ) | ||||||||||
| 116 | )\\d{5} | ||||||||||
| 117 | )| | ||||||||||
| 118 | 6(?: | ||||||||||
| 119 | [01]\\d{7}| | ||||||||||
| 120 | 4(?: | ||||||||||
| 121 | 0[56]| | ||||||||||
| 122 | 12| | ||||||||||
| 123 | 24| | ||||||||||
| 124 | 4[09] | ||||||||||
| 125 | )\\d{4,5} | ||||||||||
| 126 | )| | ||||||||||
| 127 | 8(?: | ||||||||||
| 128 | (?: | ||||||||||
| 129 | 2(?: | ||||||||||
| 130 | 3\\d| | ||||||||||
| 131 | 4[0-269]| | ||||||||||
| 132 | [578]0| | ||||||||||
| 133 | 66 | ||||||||||
| 134 | )| | ||||||||||
| 135 | 36[24-9]| | ||||||||||
| 136 | 90\\d\\d | ||||||||||
| 137 | )\\d{4}| | ||||||||||
| 138 | 4(?: | ||||||||||
| 139 | 0[56]| | ||||||||||
| 140 | 12| | ||||||||||
| 141 | 24| | ||||||||||
| 142 | 4[09] | ||||||||||
| 143 | )\\d{4,5} | ||||||||||
| 144 | )| | ||||||||||
| 145 | (?: | ||||||||||
| 146 | 2(?: | ||||||||||
| 147 | 2(?: | ||||||||||
| 148 | 0\\d\\d| | ||||||||||
| 149 | 4(?: | ||||||||||
| 150 | 0[68]| | ||||||||||
| 151 | [249]0| | ||||||||||
| 152 | 3[0-467]| | ||||||||||
| 153 | 5[0-25-9]| | ||||||||||
| 154 | 6[0235689] | ||||||||||
| 155 | ) | ||||||||||
| 156 | )| | ||||||||||
| 157 | (?: | ||||||||||
| 158 | 3(?: | ||||||||||
| 159 | [09]\\d| | ||||||||||
| 160 | 1[0-4] | ||||||||||
| 161 | )| | ||||||||||
| 162 | (?: | ||||||||||
| 163 | 4\\d| | ||||||||||
| 164 | 5[0-49]| | ||||||||||
| 165 | 6[0-29]| | ||||||||||
| 166 | 7[0-5] | ||||||||||
| 167 | )\\d | ||||||||||
| 168 | )\\d | ||||||||||
| 169 | )| | ||||||||||
| 170 | (?: | ||||||||||
| 171 | (?: | ||||||||||
| 172 | 3[2-9]| | ||||||||||
| 173 | 5[2-8]| | ||||||||||
| 174 | 6[0-35-79]| | ||||||||||
| 175 | 8[7-9] | ||||||||||
| 176 | )\\d\\d| | ||||||||||
| 177 | 4(?: | ||||||||||
| 178 | 2(?: | ||||||||||
| 179 | [089]\\d| | ||||||||||
| 180 | 7[1-9] | ||||||||||
| 181 | )| | ||||||||||
| 182 | (?: | ||||||||||
| 183 | 3[0-4]| | ||||||||||
| 184 | [78]\\d| | ||||||||||
| 185 | 9[01] | ||||||||||
| 186 | )\\d | ||||||||||
| 187 | ) | ||||||||||
| 188 | )\\d | ||||||||||
| 189 | )\\d{3} | ||||||||||
| 190 | ', | ||||||||||
| 191 | 'geographic' => ' | ||||||||||
| 192 | (?: | ||||||||||
| 193 | 2[2-8]\\d| | ||||||||||
| 194 | 370| | ||||||||||
| 195 | 55[01]| | ||||||||||
| 196 | 7[1-9] | ||||||||||
| 197 | )\\d{6}| | ||||||||||
| 198 | 4(?: | ||||||||||
| 199 | (?: | ||||||||||
| 200 | 0(?: | ||||||||||
| 201 | 0[1-9]| | ||||||||||
| 202 | [2-48]\\d | ||||||||||
| 203 | )| | ||||||||||
| 204 | 1[023]\\d | ||||||||||
| 205 | )\\d{4,5}| | ||||||||||
| 206 | (?: | ||||||||||
| 207 | [239]\\d\\d| | ||||||||||
| 208 | 4(?: | ||||||||||
| 209 | 0[56]| | ||||||||||
| 210 | 12| | ||||||||||
| 211 | 49 | ||||||||||
| 212 | ) | ||||||||||
| 213 | )\\d{5} | ||||||||||
| 214 | )| | ||||||||||
| 215 | 6(?: | ||||||||||
| 216 | [01]\\d{7}| | ||||||||||
| 217 | 4(?: | ||||||||||
| 218 | 0[56]| | ||||||||||
| 219 | 12| | ||||||||||
| 220 | 24| | ||||||||||
| 221 | 4[09] | ||||||||||
| 222 | )\\d{4,5} | ||||||||||
| 223 | )| | ||||||||||
| 224 | 8(?: | ||||||||||
| 225 | (?: | ||||||||||
| 226 | 2(?: | ||||||||||
| 227 | 3\\d| | ||||||||||
| 228 | 4[0-269]| | ||||||||||
| 229 | [578]0| | ||||||||||
| 230 | 66 | ||||||||||
| 231 | )| | ||||||||||
| 232 | 36[24-9]| | ||||||||||
| 233 | 90\\d\\d | ||||||||||
| 234 | )\\d{4}| | ||||||||||
| 235 | 4(?: | ||||||||||
| 236 | 0[56]| | ||||||||||
| 237 | 12| | ||||||||||
| 238 | 24| | ||||||||||
| 239 | 4[09] | ||||||||||
| 240 | )\\d{4,5} | ||||||||||
| 241 | )| | ||||||||||
| 242 | (?: | ||||||||||
| 243 | 2(?: | ||||||||||
| 244 | 2(?: | ||||||||||
| 245 | 0\\d\\d| | ||||||||||
| 246 | 4(?: | ||||||||||
| 247 | 0[68]| | ||||||||||
| 248 | [249]0| | ||||||||||
| 249 | 3[0-467]| | ||||||||||
| 250 | 5[0-25-9]| | ||||||||||
| 251 | 6[0235689] | ||||||||||
| 252 | ) | ||||||||||
| 253 | )| | ||||||||||
| 254 | (?: | ||||||||||
| 255 | 3(?: | ||||||||||
| 256 | [09]\\d| | ||||||||||
| 257 | 1[0-4] | ||||||||||
| 258 | )| | ||||||||||
| 259 | (?: | ||||||||||
| 260 | 4\\d| | ||||||||||
| 261 | 5[0-49]| | ||||||||||
| 262 | 6[0-29]| | ||||||||||
| 263 | 7[0-5] | ||||||||||
| 264 | )\\d | ||||||||||
| 265 | )\\d | ||||||||||
| 266 | )| | ||||||||||
| 267 | (?: | ||||||||||
| 268 | (?: | ||||||||||
| 269 | 3[2-9]| | ||||||||||
| 270 | 5[2-8]| | ||||||||||
| 271 | 6[0-35-79]| | ||||||||||
| 272 | 8[7-9] | ||||||||||
| 273 | )\\d\\d| | ||||||||||
| 274 | 4(?: | ||||||||||
| 275 | 2(?: | ||||||||||
| 276 | [089]\\d| | ||||||||||
| 277 | 7[1-9] | ||||||||||
| 278 | )| | ||||||||||
| 279 | (?: | ||||||||||
| 280 | 3[0-4]| | ||||||||||
| 281 | [78]\\d| | ||||||||||
| 282 | 9[01] | ||||||||||
| 283 | )\\d | ||||||||||
| 284 | ) | ||||||||||
| 285 | )\\d | ||||||||||
| 286 | )\\d{3} | ||||||||||
| 287 | ', | ||||||||||
| 288 | 'mobile' => ' | ||||||||||
| 289 | (?: | ||||||||||
| 290 | 40001[0-2]| | ||||||||||
| 291 | 9[0-8]\\d{4} | ||||||||||
| 292 | )\\d{3} | ||||||||||
| 293 | ', | ||||||||||
| 294 | 'pager' => '', | ||||||||||
| 295 | 'personal_number' => '99\\d{7}', | ||||||||||
| 296 | 'specialrate' => '( | ||||||||||
| 297 | 20(?: | ||||||||||
| 298 | [013-9]\\d\\d| | ||||||||||
| 299 | 2 | ||||||||||
| 300 | )\\d{4} | ||||||||||
| 301 | )|(50[0-46-9]\\d{6})', | ||||||||||
| 302 | 'toll_free' => ' | ||||||||||
| 303 | 80[0-79]\\d{6}| | ||||||||||
| 304 | 800\\d{5} | ||||||||||
| 305 | ', | ||||||||||
| 306 | 'voip' => ' | ||||||||||
| 307 | 7010(?: | ||||||||||
| 308 | [0-2679]\\d| | ||||||||||
| 309 | 3[0-7]| | ||||||||||
| 310 | 8[0-5] | ||||||||||
| 311 | )\\d{5}| | ||||||||||
| 312 | 70\\d{8} | ||||||||||
| 313 | ' | ||||||||||
| 314 | }; | ||||||||||
| 315 | 2 | my %areanames = (); | |||||||||
| 316 | 2 | $areanames{en} = {"88678", "Kaohsiung", | |||||||||
| 317 | "8864003", "Taichung\/Changhua", | ||||||||||
| 318 | "88687", "Pingtung", | ||||||||||
| 319 | "886826", "Wuqiu", | ||||||||||
| 320 | "88644", "Taichung\/Changhua", | ||||||||||
| 321 | "88680", "Pingtung", | ||||||||||
| 322 | "886825", "Kinmen", | ||||||||||
| 323 | "88657", "Chiayi\/Yunlin", | ||||||||||
| 324 | "88675", "Kaohsiung", | ||||||||||
| 325 | "8864002", "Taichung\/Changhua", | ||||||||||
| 326 | "88642", "Taichung\/Changhua", | ||||||||||
| 327 | "88643", "Taichung\/Changhua", | ||||||||||
| 328 | "88689", "Taitung", | ||||||||||
| 329 | "8864006", "Taichung\/Changhua", | ||||||||||
| 330 | "88674", "Kaohsiung", | ||||||||||
| 331 | "88672", "Kaohsiung", | ||||||||||
| 332 | "88673", "Kaohsiung", | ||||||||||
| 333 | "8864007", "Taichung\/Changhua", | ||||||||||
| 334 | "8866", "Tainan\/Penghu", | ||||||||||
| 335 | "886828", "Kinmen", | ||||||||||
| 336 | "886402", "Taichung\/Changhua", | ||||||||||
| 337 | "886827", "Kinmen", | ||||||||||
| 338 | "886408", "Taichung\/Changhua", | ||||||||||
| 339 | "88656", "Chiayi\/Yunlin", | ||||||||||
| 340 | "88648", "Taichung\/Changhua", | ||||||||||
| 341 | "8864001", "Taichung\/Changhua", | ||||||||||
| 342 | "886823", "Kinmen", | ||||||||||
| 343 | "88653", "Chiayi\/Yunlin", | ||||||||||
| 344 | "88652", "Chiayi\/Yunlin", | ||||||||||
| 345 | "88647", "Taichung\/Changhua", | ||||||||||
| 346 | "88641", "Taichung\/Changhua", | ||||||||||
| 347 | "88654", "Chiayi\/Yunlin", | ||||||||||
| 348 | "886403", "Taichung\/Changhua", | ||||||||||
| 349 | "88676", "Kaohsiung", | ||||||||||
| 350 | "88683", "Matsu", | ||||||||||
| 351 | "88649", "Nantou", | ||||||||||
| 352 | "88684", "Pingtung", | ||||||||||
| 353 | "8864008", "Taichung\/Changhua", | ||||||||||
| 354 | "8864004", "Taichung\/Changhua", | ||||||||||
| 355 | "88658", "Chiayi\/Yunlin", | ||||||||||
| 356 | "88679", "Kaohsiung", | ||||||||||
| 357 | "88637", "Miaoli", | ||||||||||
| 358 | "8863", "Taoyuan\/Hsinchu\/Yilan\/Hualien", | ||||||||||
| 359 | "8864005", "Taichung\/Changhua", | ||||||||||
| 360 | "88688", "Pingtung", | ||||||||||
| 361 | "88677", "Kaohsiung", | ||||||||||
| 362 | "88655", "Chiayi\/Yunlin", | ||||||||||
| 363 | "886404", "Taichung\/Changhua", | ||||||||||
| 364 | "886824", "Kinmen", | ||||||||||
| 365 | "88671", "Kaohsiung", | ||||||||||
| 366 | "8864009", "Taichung\/Changhua", | ||||||||||
| 367 | "8862", "Taipei",}; | ||||||||||
| 368 | 2 | $areanames{zh} = {"88678", "高雄", | |||||||||
| 369 | "8864003", "台中\、彰化", | ||||||||||
| 370 | "88687", "屏东", | ||||||||||
| 371 | "88657", "嘉义\、云林", | ||||||||||
| 372 | "88675", "高雄", | ||||||||||
| 373 | "8864002", "台中\、彰化", | ||||||||||
| 374 | "88642", "台中\、彰化", | ||||||||||
| 375 | "88643", "台中\、彰化", | ||||||||||
| 376 | "88689", "台东", | ||||||||||
| 377 | "886826", "乌丘", | ||||||||||
| 378 | "88680", "屏东", | ||||||||||
| 379 | "88644", "台中\、彰化", | ||||||||||
| 380 | "886825", "金门", | ||||||||||
| 381 | "88672", "高雄", | ||||||||||
| 382 | "88673", "高雄", | ||||||||||
| 383 | "8864006", "台中\、彰化", | ||||||||||
| 384 | "88674", "高雄", | ||||||||||
| 385 | "886408", "台中\、彰化", | ||||||||||
| 386 | "88656", "嘉义\、云林", | ||||||||||
| 387 | "8864001", "台中\、彰化", | ||||||||||
| 388 | "88648", "台中\、彰化", | ||||||||||
| 389 | "8864007", "台中\、彰化", | ||||||||||
| 390 | "8866", "台南\、澎湖", | ||||||||||
| 391 | "886827", "金门", | ||||||||||
| 392 | "886402", "台中\、彰化", | ||||||||||
| 393 | "886828", "金门", | ||||||||||
| 394 | "88641", "台中\、彰化", | ||||||||||
| 395 | "88654", "嘉义\、云林", | ||||||||||
| 396 | "886403", "台中\、彰化", | ||||||||||
| 397 | "886823", "金门", | ||||||||||
| 398 | "88653", "嘉义\、云林", | ||||||||||
| 399 | "88652", "嘉义\、云林", | ||||||||||
| 400 | "88647", "台中\、彰化", | ||||||||||
| 401 | "88684", "屏东", | ||||||||||
| 402 | "88676", "高雄", | ||||||||||
| 403 | "88683", "马祖", | ||||||||||
| 404 | "88649", "南投", | ||||||||||
| 405 | "8863", "桃园\、新竹\、花莲\、宜兰", | ||||||||||
| 406 | "88637", "苗栗", | ||||||||||
| 407 | "88658", "嘉义\、云林", | ||||||||||
| 408 | "8864004", "台中\、彰化", | ||||||||||
| 409 | "8864008", "台中\、彰化", | ||||||||||
| 410 | "88679", "高雄", | ||||||||||
| 411 | "886824", "金门", | ||||||||||
| 412 | "88671", "高雄", | ||||||||||
| 413 | "8868230", "屏东", | ||||||||||
| 414 | "8864009", "台中\、彰化", | ||||||||||
| 415 | "8862", "台北", | ||||||||||
| 416 | "8864005", "台中\、彰化", | ||||||||||
| 417 | "88688", "屏东", | ||||||||||
| 418 | "886404", "台中\、彰化", | ||||||||||
| 419 | "88655", "嘉义\、云林", | ||||||||||
| 420 | "88677", "高雄",}; | ||||||||||
| 421 | 2 | my $timezones = { | |||||||||
| 422 | '' => [ | ||||||||||
| 423 | 'Asia/Taipei' | ||||||||||
| 424 | ] | ||||||||||
| 425 | }; | ||||||||||
| 426 | |||||||||||
| 427 | 22 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 428 | 22 | my $class = shift; | |||||||||
| 429 | 22 | my $number = shift; | |||||||||
| 430 | 22 | $number =~ s/(^\+886|\D)//g; | |||||||||
| 431 | 22 | my $self = bless({ country_code => '886', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 432 | 22 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 433 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 434 | 1 | $self = bless({ country_code => '886', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 435 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 436 | } | ||||||||||
| 437 | 2 | 1; | |||||||||