| 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::PE; | ||||||||||
| 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' => '80', | ||||||||||
| 31 | 'national_rule' => '(0$1)', | ||||||||||
| 32 | 'pattern' => '(\\d{3})(\\d{5})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2', | ||||||||||
| 36 | 'leading_digits' => '1', | ||||||||||
| 37 | 'national_rule' => '(0$1)', | ||||||||||
| 38 | 'pattern' => '(\\d)(\\d{7})' | ||||||||||
| 39 | }, | ||||||||||
| 40 | { | ||||||||||
| 41 | 'format' => '$1 $2', | ||||||||||
| 42 | 'leading_digits' => '[4-8]', | ||||||||||
| 43 | 'national_rule' => '(0$1)', | ||||||||||
| 44 | 'pattern' => '(\\d{2})(\\d{6})' | ||||||||||
| 45 | }, | ||||||||||
| 46 | { | ||||||||||
| 47 | 'format' => '$1 $2 $3', | ||||||||||
| 48 | 'leading_digits' => '9', | ||||||||||
| 49 | 'pattern' => '(\\d{3})(\\d{3})(\\d{3})' | ||||||||||
| 50 | } | ||||||||||
| 51 | ]; | ||||||||||
| 52 | |||||||||||
| 53 | 2 | my $validators = { | |||||||||
| 54 | 'fixed_line' => ' | ||||||||||
| 55 | (?: | ||||||||||
| 56 | (?: | ||||||||||
| 57 | 19[02-68]| | ||||||||||
| 58 | (?: | ||||||||||
| 59 | 4[34]| | ||||||||||
| 60 | 5[14] | ||||||||||
| 61 | )[0-8]| | ||||||||||
| 62 | 687 | ||||||||||
| 63 | )\\d| | ||||||||||
| 64 | 7(?: | ||||||||||
| 65 | 173| | ||||||||||
| 66 | (?: | ||||||||||
| 67 | 3[0-8]| | ||||||||||
| 68 | 55 | ||||||||||
| 69 | )\\d | ||||||||||
| 70 | )| | ||||||||||
| 71 | 8(?: | ||||||||||
| 72 | 10[05689]| | ||||||||||
| 73 | 6(?: | ||||||||||
| 74 | 0[06-9]| | ||||||||||
| 75 | 1[6-9]| | ||||||||||
| 76 | 29 | ||||||||||
| 77 | )| | ||||||||||
| 78 | 7(?: | ||||||||||
| 79 | 0[0569]| | ||||||||||
| 80 | [56]0 | ||||||||||
| 81 | ) | ||||||||||
| 82 | ) | ||||||||||
| 83 | )\\d{4}| | ||||||||||
| 84 | (?: | ||||||||||
| 85 | 1[0-8]| | ||||||||||
| 86 | 4[12]| | ||||||||||
| 87 | 5[236]| | ||||||||||
| 88 | 6[1-7]| | ||||||||||
| 89 | 7[246]| | ||||||||||
| 90 | 8[2-4] | ||||||||||
| 91 | )\\d{6} | ||||||||||
| 92 | ', | ||||||||||
| 93 | 'geographic' => ' | ||||||||||
| 94 | (?: | ||||||||||
| 95 | (?: | ||||||||||
| 96 | 19[02-68]| | ||||||||||
| 97 | (?: | ||||||||||
| 98 | 4[34]| | ||||||||||
| 99 | 5[14] | ||||||||||
| 100 | )[0-8]| | ||||||||||
| 101 | 687 | ||||||||||
| 102 | )\\d| | ||||||||||
| 103 | 7(?: | ||||||||||
| 104 | 173| | ||||||||||
| 105 | (?: | ||||||||||
| 106 | 3[0-8]| | ||||||||||
| 107 | 55 | ||||||||||
| 108 | )\\d | ||||||||||
| 109 | )| | ||||||||||
| 110 | 8(?: | ||||||||||
| 111 | 10[05689]| | ||||||||||
| 112 | 6(?: | ||||||||||
| 113 | 0[06-9]| | ||||||||||
| 114 | 1[6-9]| | ||||||||||
| 115 | 29 | ||||||||||
| 116 | )| | ||||||||||
| 117 | 7(?: | ||||||||||
| 118 | 0[0569]| | ||||||||||
| 119 | [56]0 | ||||||||||
| 120 | ) | ||||||||||
| 121 | ) | ||||||||||
| 122 | )\\d{4}| | ||||||||||
| 123 | (?: | ||||||||||
| 124 | 1[0-8]| | ||||||||||
| 125 | 4[12]| | ||||||||||
| 126 | 5[236]| | ||||||||||
| 127 | 6[1-7]| | ||||||||||
| 128 | 7[246]| | ||||||||||
| 129 | 8[2-4] | ||||||||||
| 130 | )\\d{6} | ||||||||||
| 131 | ', | ||||||||||
| 132 | 'mobile' => '9\\d{8}', | ||||||||||
| 133 | 'pager' => '', | ||||||||||
| 134 | 'personal_number' => '80[24]\\d{5}', | ||||||||||
| 135 | 'specialrate' => '(801\\d{5})|(805\\d{5})', | ||||||||||
| 136 | 'toll_free' => '800\\d{5}', | ||||||||||
| 137 | 'voip' => '' | ||||||||||
| 138 | }; | ||||||||||
| 139 | 2 | my %areanames = (); | |||||||||
| 140 | 2 | $areanames{en} = {"5142", "San\ Martín", | |||||||||
| 141 | "5163", "Pasco", | ||||||||||
| 142 | "5182", "Madre\ de\ Dios", | ||||||||||
| 143 | "5174", "Lambayeque", | ||||||||||
| 144 | "5153", "Moquegua", | ||||||||||
| 145 | "5156", "Ica", | ||||||||||
| 146 | "5167", "Huancavelica", | ||||||||||
| 147 | "5166", "Ayacucho", | ||||||||||
| 148 | "5175", "Lima", | ||||||||||
| 149 | "5162", "Huánuco", | ||||||||||
| 150 | "5143", "Ancash", | ||||||||||
| 151 | "5183", "Apurímac", | ||||||||||
| 152 | "511", "Lima\/Callao", | ||||||||||
| 153 | "5152", "Tacna", | ||||||||||
| 154 | "5164", "Junín", | ||||||||||
| 155 | "5173", "Piura", | ||||||||||
| 156 | "5154", "Arequipa", | ||||||||||
| 157 | "5168", "Lima", | ||||||||||
| 158 | "5161", "Ucayali", | ||||||||||
| 159 | "5151", "Puno", | ||||||||||
| 160 | "5144", "La\ Libertad", | ||||||||||
| 161 | "5184", "Cusco", | ||||||||||
| 162 | "5172", "Tumbes", | ||||||||||
| 163 | "5176", "Cajamarca", | ||||||||||
| 164 | "5141", "Amazonas", | ||||||||||
| 165 | "5165", "Loreto",}; | ||||||||||
| 166 | 2 | my $timezones = { | |||||||||
| 167 | '' => [ | ||||||||||
| 168 | 'America/Lima' | ||||||||||
| 169 | ] | ||||||||||
| 170 | }; | ||||||||||
| 171 | |||||||||||
| 172 | 19 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 173 | 19 | my $class = shift; | |||||||||
| 174 | 19 | my $number = shift; | |||||||||
| 175 | 19 | $number =~ s/(^\+51|\D)//g; | |||||||||
| 176 | 19 | my $self = bless({ country_code => '51', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 177 | 19 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 178 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 179 | 1 | $self = bless({ country_code => '51', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 180 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 181 | } | ||||||||||
| 182 | 2 | 1; | |||||||||