| 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::LK; | ||||||||||
| 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 $3', | ||||||||||
| 30 | 'leading_digits' => '7', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d{2})(\\d{3})(\\d{4})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3', | ||||||||||
| 36 | 'leading_digits' => '[1-689]', | ||||||||||
| 37 | 'national_rule' => '0$1', | ||||||||||
| 38 | 'pattern' => '(\\d{3})(\\d{3})(\\d{3})' | ||||||||||
| 39 | } | ||||||||||
| 40 | ]; | ||||||||||
| 41 | |||||||||||
| 42 | 2 | my $validators = { | |||||||||
| 43 | 'fixed_line' => ' | ||||||||||
| 44 | (?: | ||||||||||
| 45 | 12[2-9]| | ||||||||||
| 46 | 602| | ||||||||||
| 47 | 8[12]\\d| | ||||||||||
| 48 | 9(?: | ||||||||||
| 49 | 1\\d| | ||||||||||
| 50 | 22| | ||||||||||
| 51 | 9[245] | ||||||||||
| 52 | ) | ||||||||||
| 53 | )\\d{6}| | ||||||||||
| 54 | (?: | ||||||||||
| 55 | 11| | ||||||||||
| 56 | 2[13-7]| | ||||||||||
| 57 | 3[1-8]| | ||||||||||
| 58 | 4[157]| | ||||||||||
| 59 | 5[12457]| | ||||||||||
| 60 | 6[35-7] | ||||||||||
| 61 | )[2-57]\\d{6} | ||||||||||
| 62 | ', | ||||||||||
| 63 | 'geographic' => ' | ||||||||||
| 64 | (?: | ||||||||||
| 65 | 12[2-9]| | ||||||||||
| 66 | 602| | ||||||||||
| 67 | 8[12]\\d| | ||||||||||
| 68 | 9(?: | ||||||||||
| 69 | 1\\d| | ||||||||||
| 70 | 22| | ||||||||||
| 71 | 9[245] | ||||||||||
| 72 | ) | ||||||||||
| 73 | )\\d{6}| | ||||||||||
| 74 | (?: | ||||||||||
| 75 | 11| | ||||||||||
| 76 | 2[13-7]| | ||||||||||
| 77 | 3[1-8]| | ||||||||||
| 78 | 4[157]| | ||||||||||
| 79 | 5[12457]| | ||||||||||
| 80 | 6[35-7] | ||||||||||
| 81 | )[2-57]\\d{6} | ||||||||||
| 82 | ', | ||||||||||
| 83 | 'mobile' => ' | ||||||||||
| 84 | 7(?: | ||||||||||
| 85 | [0-25-8]\\d| | ||||||||||
| 86 | 4[0-4] | ||||||||||
| 87 | )\\d{6} | ||||||||||
| 88 | ', | ||||||||||
| 89 | 'pager' => '', | ||||||||||
| 90 | 'personal_number' => '', | ||||||||||
| 91 | 'specialrate' => '(1973\\d{5})', | ||||||||||
| 92 | 'toll_free' => '', | ||||||||||
| 93 | 'voip' => '' | ||||||||||
| 94 | }; | ||||||||||
| 95 | 2 | my %areanames = (); | |||||||||
| 96 | 2 | $areanames{en} = {"9482", "Kandy", | |||||||||
| 97 | "9432", "Chilaw\,\ Puttalam", | ||||||||||
| 98 | "9463", "Ampara", | ||||||||||
| 99 | "9426", "Trincomalee", | ||||||||||
| 100 | "9427", "Polonnaruwa", | ||||||||||
| 101 | "9436", "Avissawella\,\ Colombo", | ||||||||||
| 102 | "9437", "Kurunegala", | ||||||||||
| 103 | "9447", "Hambantota", | ||||||||||
| 104 | "9411", "Colombo", | ||||||||||
| 105 | "9491", "Galle", | ||||||||||
| 106 | "9452", "Nuwara\ Eliya", | ||||||||||
| 107 | "9433", "Gampaha", | ||||||||||
| 108 | "9457", "Bandarawela\,\ Badulla", | ||||||||||
| 109 | "9466", "Matale", | ||||||||||
| 110 | "9467", "Kalmunai\,\ Ampara", | ||||||||||
| 111 | "9423", "Mannar", | ||||||||||
| 112 | "9451", "Hatton\,\ Nuwara\ Eliya", | ||||||||||
| 113 | "9435", "Kegalle", | ||||||||||
| 114 | "9445", "Ratnapura", | ||||||||||
| 115 | "9454", "Nawalapitiya\,\ Kandy", | ||||||||||
| 116 | "9425", "Anuradhapura", | ||||||||||
| 117 | "9441", "Matara", | ||||||||||
| 118 | "9438", "Panadura\,\ Kalutara", | ||||||||||
| 119 | "9431", "Negombo\,\ Gampaha", | ||||||||||
| 120 | "9465", "Batticaloa", | ||||||||||
| 121 | "9455", "Badulla", | ||||||||||
| 122 | "9424", "Vavuniya", | ||||||||||
| 123 | "9434", "Kalutara", | ||||||||||
| 124 | "9421", "Jaffna",}; | ||||||||||
| 125 | 2 | my $timezones = { | |||||||||
| 126 | '' => [ | ||||||||||
| 127 | 'Asia/Colombo' | ||||||||||
| 128 | ] | ||||||||||
| 129 | }; | ||||||||||
| 130 | |||||||||||
| 131 | 10 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 132 | 10 | my $class = shift; | |||||||||
| 133 | 10 | my $number = shift; | |||||||||
| 134 | 10 | $number =~ s/(^\+94|\D)//g; | |||||||||
| 135 | 10 | my $self = bless({ country_code => '94', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 136 | 10 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 137 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 138 | 1 | $self = bless({ country_code => '94', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 139 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | } | ||||||||||
| 141 | 2 | 1; | |||||||||