| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # automatically generated file, don't edit | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | # Copyright 2023 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 |  |  | 2 |  | 1190 | use base qw(Number::Phone::StubCountry); | 
|  | 2 |  |  |  |  | 15 |  | 
|  | 2 |  |  |  |  | 323 |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 |  |  | 2 |  | 22 | use strict; | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 54 |  | 
| 23 | 2 |  |  | 2 |  | 13 | use warnings; | 
|  | 2 |  |  |  |  | 12 |  | 
|  | 2 |  |  |  |  | 62 |  | 
| 24 | 2 |  |  | 2 |  | 11 | use utf8; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 12 |  | 
| 25 |  |  |  |  |  |  | our $VERSION = 1.20230903131448; | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | my $formatters = [ | 
| 28 |  |  |  |  |  |  | { | 
| 29 |  |  |  |  |  |  | 'format' => '$1 $2', | 
| 30 |  |  |  |  |  |  | 'leading_digits' => '2024', | 
| 31 |  |  |  |  |  |  | 'national_rule' => '0$1', | 
| 32 |  |  |  |  |  |  | 'pattern' => '(\\d{4})(\\d{5})' | 
| 33 |  |  |  |  |  |  | }, | 
| 34 |  |  |  |  |  |  | { | 
| 35 |  |  |  |  |  |  | 'format' => '$1 $2', | 
| 36 |  |  |  |  |  |  | 'leading_digits' => ' | 
| 37 |  |  |  |  |  |  | [27-9]| | 
| 38 |  |  |  |  |  |  | 4(?: | 
| 39 |  |  |  |  |  |  | 6[45]| | 
| 40 |  |  |  |  |  |  | [7-9] | 
| 41 |  |  |  |  |  |  | ) | 
| 42 |  |  |  |  |  |  | ', | 
| 43 |  |  |  |  |  |  | 'national_rule' => '0$1', | 
| 44 |  |  |  |  |  |  | 'pattern' => '(\\d{3})(\\d{6})' | 
| 45 |  |  |  |  |  |  | }, | 
| 46 |  |  |  |  |  |  | { | 
| 47 |  |  |  |  |  |  | 'format' => '$1 $2', | 
| 48 |  |  |  |  |  |  | 'leading_digits' => '[34]', | 
| 49 |  |  |  |  |  |  | 'national_rule' => '0$1', | 
| 50 |  |  |  |  |  |  | 'pattern' => '(\\d{2})(\\d{7})' | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  | ]; | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | my $validators = { | 
| 55 |  |  |  |  |  |  | 'fixed_line' => ' | 
| 56 |  |  |  |  |  |  | 20(?: | 
| 57 |  |  |  |  |  |  | (?: | 
| 58 |  |  |  |  |  |  | 240| | 
| 59 |  |  |  |  |  |  | 30[67] | 
| 60 |  |  |  |  |  |  | )\\d| | 
| 61 |  |  |  |  |  |  | 6(?: | 
| 62 |  |  |  |  |  |  | 00[0-2]| | 
| 63 |  |  |  |  |  |  | 30[0-4] | 
| 64 |  |  |  |  |  |  | ) | 
| 65 |  |  |  |  |  |  | )\\d{3}| | 
| 66 |  |  |  |  |  |  | (?: | 
| 67 |  |  |  |  |  |  | 20(?: | 
| 68 |  |  |  |  |  |  | [017]\\d| | 
| 69 |  |  |  |  |  |  | 2[5-9]| | 
| 70 |  |  |  |  |  |  | 32| | 
| 71 |  |  |  |  |  |  | 5[0-4]| | 
| 72 |  |  |  |  |  |  | 6[15-9] | 
| 73 |  |  |  |  |  |  | )| | 
| 74 |  |  |  |  |  |  | [34]\\d{3} | 
| 75 |  |  |  |  |  |  | )\\d{5} | 
| 76 |  |  |  |  |  |  | ', | 
| 77 |  |  |  |  |  |  | 'geographic' => ' | 
| 78 |  |  |  |  |  |  | 20(?: | 
| 79 |  |  |  |  |  |  | (?: | 
| 80 |  |  |  |  |  |  | 240| | 
| 81 |  |  |  |  |  |  | 30[67] | 
| 82 |  |  |  |  |  |  | )\\d| | 
| 83 |  |  |  |  |  |  | 6(?: | 
| 84 |  |  |  |  |  |  | 00[0-2]| | 
| 85 |  |  |  |  |  |  | 30[0-4] | 
| 86 |  |  |  |  |  |  | ) | 
| 87 |  |  |  |  |  |  | )\\d{3}| | 
| 88 |  |  |  |  |  |  | (?: | 
| 89 |  |  |  |  |  |  | 20(?: | 
| 90 |  |  |  |  |  |  | [017]\\d| | 
| 91 |  |  |  |  |  |  | 2[5-9]| | 
| 92 |  |  |  |  |  |  | 32| | 
| 93 |  |  |  |  |  |  | 5[0-4]| | 
| 94 |  |  |  |  |  |  | 6[15-9] | 
| 95 |  |  |  |  |  |  | )| | 
| 96 |  |  |  |  |  |  | [34]\\d{3} | 
| 97 |  |  |  |  |  |  | )\\d{5} | 
| 98 |  |  |  |  |  |  | ', | 
| 99 |  |  |  |  |  |  | 'mobile' => ' | 
| 100 |  |  |  |  |  |  | 726[01]\\d{5}| | 
| 101 |  |  |  |  |  |  | 7(?: | 
| 102 |  |  |  |  |  |  | [01578]\\d| | 
| 103 |  |  |  |  |  |  | 20| | 
| 104 |  |  |  |  |  |  | 36| | 
| 105 |  |  |  |  |  |  | 4[0-4]| | 
| 106 |  |  |  |  |  |  | 6[0-5]| | 
| 107 |  |  |  |  |  |  | 9[89] | 
| 108 |  |  |  |  |  |  | )\\d{6} | 
| 109 |  |  |  |  |  |  | ', | 
| 110 |  |  |  |  |  |  | 'pager' => '', | 
| 111 |  |  |  |  |  |  | 'personal_number' => '', | 
| 112 |  |  |  |  |  |  | 'specialrate' => '(90[1-3]\\d{6})', | 
| 113 |  |  |  |  |  |  | 'toll_free' => '800[1-3]\\d{5}', | 
| 114 |  |  |  |  |  |  | 'voip' => '' | 
| 115 |  |  |  |  |  |  | }; | 
| 116 |  |  |  |  |  |  | my %areanames = (); | 
| 117 |  |  |  |  |  |  | $areanames{en} = {"25645", "Mbale", | 
| 118 |  |  |  |  |  |  | "256473", "Lira", | 
| 119 |  |  |  |  |  |  | "256476", "Arua", | 
| 120 |  |  |  |  |  |  | "256481", "Masaka", | 
| 121 |  |  |  |  |  |  | "256464", "Mubende", | 
| 122 |  |  |  |  |  |  | "256485", "Mbarara", | 
| 123 |  |  |  |  |  |  | "256465", "Masindi", | 
| 124 |  |  |  |  |  |  | "25646", "Mityana", | 
| 125 |  |  |  |  |  |  | "256486", "Kabale\/Rukungiri\/Kisoro", | 
| 126 |  |  |  |  |  |  | "256483", "Fort\ Portal", | 
| 127 |  |  |  |  |  |  | "256471", "Gulu", | 
| 128 |  |  |  |  |  |  | "25643", "Jinja", | 
| 129 |  |  |  |  |  |  | "25641", "Kampala",}; | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | sub new { | 
| 132 | 13 |  |  | 13 | 1 | 36 | my $class = shift; | 
| 133 | 13 |  |  |  |  | 36 | my $number = shift; | 
| 134 | 13 |  |  |  |  | 90 | $number =~ s/(^\+256|\D)//g; | 
| 135 | 13 |  |  |  |  | 80 | my $self = bless({ country_code => '256', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | 
| 136 | 13 | 100 |  |  |  | 71 | return $self if ($self->is_valid()); | 
| 137 | 1 |  |  |  |  | 4 | $number =~ s/^(?:0)//; | 
| 138 | 1 |  |  |  |  | 11 | $self = bless({ country_code => '256', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | 
| 139 | 1 | 50 |  |  |  | 7 | return $self->is_valid() ? $self : undef; | 
| 140 |  |  |  |  |  |  | } | 
| 141 |  |  |  |  |  |  | 1; |