| 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::UG; | ||||||||||
| 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' => '20240', | ||||||||||
| 31 | 'national_rule' => '0$1', | ||||||||||
| 32 | 'pattern' => '(\\d{4})(\\d{5})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2', | ||||||||||
| 36 | 'leading_digits' => ' | ||||||||||
| 37 | 20(?: | ||||||||||
| 38 | [0135-7]| | ||||||||||
| 39 | 2[5-9] | ||||||||||
| 40 | )| | ||||||||||
| 41 | 4(?: | ||||||||||
| 42 | 6[45]| | ||||||||||
| 43 | [7-9] | ||||||||||
| 44 | )| | ||||||||||
| 45 | [7-9] | ||||||||||
| 46 | ', | ||||||||||
| 47 | 'national_rule' => '0$1', | ||||||||||
| 48 | 'pattern' => '(\\d{3})(\\d{6})' | ||||||||||
| 49 | }, | ||||||||||
| 50 | { | ||||||||||
| 51 | 'format' => '$1 $2', | ||||||||||
| 52 | 'leading_digits' => '[2-4]', | ||||||||||
| 53 | 'national_rule' => '0$1', | ||||||||||
| 54 | 'pattern' => '(\\d{2})(\\d{7})' | ||||||||||
| 55 | } | ||||||||||
| 56 | ]; | ||||||||||
| 57 | |||||||||||
| 58 | 2 | my $validators = { | |||||||||
| 59 | 'fixed_line' => ' | ||||||||||
| 60 | 20(?: | ||||||||||
| 61 | (?: | ||||||||||
| 62 | 24[09]| | ||||||||||
| 63 | 30[67] | ||||||||||
| 64 | )\\d| | ||||||||||
| 65 | 6(?: | ||||||||||
| 66 | 00[0-2]| | ||||||||||
| 67 | 30[0-4] | ||||||||||
| 68 | ) | ||||||||||
| 69 | )\\d{3}| | ||||||||||
| 70 | (?: | ||||||||||
| 71 | 20(?: | ||||||||||
| 72 | [017]\\d| | ||||||||||
| 73 | 2[5-9]| | ||||||||||
| 74 | 3[1-4]| | ||||||||||
| 75 | 5[0-4]| | ||||||||||
| 76 | 6[15-9] | ||||||||||
| 77 | )| | ||||||||||
| 78 | [34]\\d{3} | ||||||||||
| 79 | )\\d{5} | ||||||||||
| 80 | ', | ||||||||||
| 81 | 'geographic' => ' | ||||||||||
| 82 | 20(?: | ||||||||||
| 83 | (?: | ||||||||||
| 84 | 24[09]| | ||||||||||
| 85 | 30[67] | ||||||||||
| 86 | )\\d| | ||||||||||
| 87 | 6(?: | ||||||||||
| 88 | 00[0-2]| | ||||||||||
| 89 | 30[0-4] | ||||||||||
| 90 | ) | ||||||||||
| 91 | )\\d{3}| | ||||||||||
| 92 | (?: | ||||||||||
| 93 | 20(?: | ||||||||||
| 94 | [017]\\d| | ||||||||||
| 95 | 2[5-9]| | ||||||||||
| 96 | 3[1-4]| | ||||||||||
| 97 | 5[0-4]| | ||||||||||
| 98 | 6[15-9] | ||||||||||
| 99 | )| | ||||||||||
| 100 | [34]\\d{3} | ||||||||||
| 101 | )\\d{5} | ||||||||||
| 102 | ', | ||||||||||
| 103 | 'mobile' => ' | ||||||||||
| 104 | 7(?: | ||||||||||
| 105 | 28| | ||||||||||
| 106 | 34 | ||||||||||
| 107 | )0\\d{5}| | ||||||||||
| 108 | 7(?: | ||||||||||
| 109 | [014-8]\\d| | ||||||||||
| 110 | 2[01467]| | ||||||||||
| 111 | 3[0167]| | ||||||||||
| 112 | 9[0-589] | ||||||||||
| 113 | )\\d{6} | ||||||||||
| 114 | ', | ||||||||||
| 115 | 'pager' => '', | ||||||||||
| 116 | 'personal_number' => '', | ||||||||||
| 117 | 'specialrate' => '(90[1-3]\\d{6})', | ||||||||||
| 118 | 'toll_free' => '800[1-3]\\d{5}', | ||||||||||
| 119 | 'voip' => '' | ||||||||||
| 120 | }; | ||||||||||
| 121 | 2 | my %areanames = (); | |||||||||
| 122 | 2 | $areanames{en} = {"256486", "Kabale\/Rukungiri\/Kisoro", | |||||||||
| 123 | "25643", "Jinja", | ||||||||||
| 124 | "256485", "Mbarara", | ||||||||||
| 125 | "256473", "Lira", | ||||||||||
| 126 | "256471", "Gulu", | ||||||||||
| 127 | "256483", "Fort\ Portal", | ||||||||||
| 128 | "256464", "Mubende", | ||||||||||
| 129 | "256481", "Masaka", | ||||||||||
| 130 | "25641", "Kampala", | ||||||||||
| 131 | "25645", "Mbale", | ||||||||||
| 132 | "256476", "Arua", | ||||||||||
| 133 | "25646", "Mityana", | ||||||||||
| 134 | "256465", "Masindi",}; | ||||||||||
| 135 | 2 | my $timezones = { | |||||||||
| 136 | '' => [ | ||||||||||
| 137 | 'Africa/Kampala' | ||||||||||
| 138 | ] | ||||||||||
| 139 | }; | ||||||||||
| 140 | |||||||||||
| 141 | 13 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 142 | 13 | my $class = shift; | |||||||||
| 143 | 13 | my $number = shift; | |||||||||
| 144 | 13 | $number =~ s/(^\+256|\D)//g; | |||||||||
| 145 | 13 | my $self = bless({ country_code => '256', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 146 | 13 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 147 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 148 | 1 | $self = bless({ country_code => '256', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 149 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 150 | } | ||||||||||
| 151 | 2 | 1; | |||||||||