| 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::TO; | ||||||||||
| 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', | ||||||||||
| 30 | 'leading_digits' => ' | ||||||||||
| 31 | [2-4]| | ||||||||||
| 32 | 50| | ||||||||||
| 33 | 6[09]| | ||||||||||
| 34 | 7[0-24-69]| | ||||||||||
| 35 | 8[05] | ||||||||||
| 36 | ', | ||||||||||
| 37 | 'pattern' => '(\\d{2})(\\d{3})' | ||||||||||
| 38 | }, | ||||||||||
| 39 | { | ||||||||||
| 40 | 'format' => '$1 $2', | ||||||||||
| 41 | 'pattern' => '(\\d{4})(\\d{3})' | ||||||||||
| 42 | }, | ||||||||||
| 43 | { | ||||||||||
| 44 | 'format' => '$1 $2', | ||||||||||
| 45 | 'leading_digits' => '[5-9]', | ||||||||||
| 46 | 'pattern' => '(\\d{3})(\\d{4})' | ||||||||||
| 47 | } | ||||||||||
| 48 | ]; | ||||||||||
| 49 | |||||||||||
| 50 | 2 | my $validators = { | |||||||||
| 51 | 'fixed_line' => ' | ||||||||||
| 52 | (?: | ||||||||||
| 53 | 2\\d| | ||||||||||
| 54 | 3[0-8]| | ||||||||||
| 55 | 4[0-4]| | ||||||||||
| 56 | 50| | ||||||||||
| 57 | 6[09]| | ||||||||||
| 58 | 7[0-24-69]| | ||||||||||
| 59 | 8[05] | ||||||||||
| 60 | )\\d{3} | ||||||||||
| 61 | ', | ||||||||||
| 62 | 'geographic' => ' | ||||||||||
| 63 | (?: | ||||||||||
| 64 | 2\\d| | ||||||||||
| 65 | 3[0-8]| | ||||||||||
| 66 | 4[0-4]| | ||||||||||
| 67 | 50| | ||||||||||
| 68 | 6[09]| | ||||||||||
| 69 | 7[0-24-69]| | ||||||||||
| 70 | 8[05] | ||||||||||
| 71 | )\\d{3} | ||||||||||
| 72 | ', | ||||||||||
| 73 | 'mobile' => ' | ||||||||||
| 74 | (?: | ||||||||||
| 75 | 5(?: | ||||||||||
| 76 | 4[0-5]| | ||||||||||
| 77 | 5[4-6] | ||||||||||
| 78 | )| | ||||||||||
| 79 | 6(?: | ||||||||||
| 80 | [09]\\d| | ||||||||||
| 81 | 3[02]| | ||||||||||
| 82 | 8[15-9] | ||||||||||
| 83 | )| | ||||||||||
| 84 | (?: | ||||||||||
| 85 | 7\\d| | ||||||||||
| 86 | 8[46-9] | ||||||||||
| 87 | )\\d| | ||||||||||
| 88 | 999 | ||||||||||
| 89 | )\\d{4} | ||||||||||
| 90 | ', | ||||||||||
| 91 | 'pager' => '', | ||||||||||
| 92 | 'personal_number' => '', | ||||||||||
| 93 | 'specialrate' => '', | ||||||||||
| 94 | 'toll_free' => '0800\\d{3}', | ||||||||||
| 95 | 'voip' => '55[0-37-9]\\d{4}' | ||||||||||
| 96 | }; | ||||||||||
| 97 | 2 | my %areanames = (); | |||||||||
| 98 | 2 | $areanames{en} = {"67680", "Niuas", | |||||||||
| 99 | "67676", "Vava\’u", | ||||||||||
| 100 | "67638", "Vaini", | ||||||||||
| 101 | "67640", "Kolovai", | ||||||||||
| 102 | "67643", "Matangiake", | ||||||||||
| 103 | "67642", "Masilamea", | ||||||||||
| 104 | "67675", "Vava\’u", | ||||||||||
| 105 | "67650", "\‘Eua", | ||||||||||
| 106 | "67635", "Nakolo", | ||||||||||
| 107 | "67636", "Nakolo", | ||||||||||
| 108 | "67641", "Masilamea", | ||||||||||
| 109 | "67630", "Pea", | ||||||||||
| 110 | "67633", "Kolonga", | ||||||||||
| 111 | "67632", "Muʻa", | ||||||||||
| 112 | "6762", "Nuku\'alofa", | ||||||||||
| 113 | "67634", "Kolonga", | ||||||||||
| 114 | "67671", "Vava\’u", | ||||||||||
| 115 | "67679", "Vava\’u", | ||||||||||
| 116 | "67669", "Ha\’apai", | ||||||||||
| 117 | "67674", "Vava\’u", | ||||||||||
| 118 | "67631", "Muʻa", | ||||||||||
| 119 | "67685", "Niuas", | ||||||||||
| 120 | "67629", "Pea", | ||||||||||
| 121 | "67660", "Ha\’apai", | ||||||||||
| 122 | "67637", "Vaini", | ||||||||||
| 123 | "67670", "Vava\’u", | ||||||||||
| 124 | "67672", "Vava\’u",}; | ||||||||||
| 125 | 2 | my $timezones = { | |||||||||
| 126 | '' => [ | ||||||||||
| 127 | 'Pacific/Tongatapu' | ||||||||||
| 128 | ] | ||||||||||
| 129 | }; | ||||||||||
| 130 | |||||||||||
| 131 | 13 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 132 | 13 | my $class = shift; | |||||||||
| 133 | 13 | my $number = shift; | |||||||||
| 134 | 13 | $number =~ s/(^\+676|\D)//g; | |||||||||
| 135 | 13 | my $self = bless({ country_code => '676', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 136 | 13 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 137 | } | ||||||||||
| 138 | 2 | 1; | |||||||||