| 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::BW; | ||||||||||
| 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.20260904101548; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2', | ||||||||||
| 30 | 'leading_digits' => '90', | ||||||||||
| 31 | 'pattern' => '(\\d{2})(\\d{5})' | ||||||||||
| 32 | }, | ||||||||||
| 33 | { | ||||||||||
| 34 | 'format' => '$1 $2', | ||||||||||
| 35 | 'leading_digits' => ' | ||||||||||
| 36 | [24-6]| | ||||||||||
| 37 | 3[15-9] | ||||||||||
| 38 | ', | ||||||||||
| 39 | 'pattern' => '(\\d{3})(\\d{4})' | ||||||||||
| 40 | }, | ||||||||||
| 41 | { | ||||||||||
| 42 | 'format' => '$1 $2 $3', | ||||||||||
| 43 | 'leading_digits' => '[37]', | ||||||||||
| 44 | 'pattern' => '(\\d{2})(\\d{3})(\\d{3})' | ||||||||||
| 45 | }, | ||||||||||
| 46 | { | ||||||||||
| 47 | 'format' => '$1 $2 $3', | ||||||||||
| 48 | 'pattern' => '(\\d{4})(\\d{3})(\\d{3})' | ||||||||||
| 49 | }, | ||||||||||
| 50 | { | ||||||||||
| 51 | 'format' => '$1 $2 $3', | ||||||||||
| 52 | 'leading_digits' => '8', | ||||||||||
| 53 | 'pattern' => '(\\d{3})(\\d{4})(\\d{3})' | ||||||||||
| 54 | } | ||||||||||
| 55 | ]; | ||||||||||
| 56 | |||||||||||
| 57 | 2 | my $validators = { | |||||||||
| 58 | 'fixed_line' => ' | ||||||||||
| 59 | (?: | ||||||||||
| 60 | 2(?: | ||||||||||
| 61 | 4[0-48]| | ||||||||||
| 62 | 6[0-24]| | ||||||||||
| 63 | 9[0578] | ||||||||||
| 64 | )| | ||||||||||
| 65 | 3(?: | ||||||||||
| 66 | 1[0-35-9]| | ||||||||||
| 67 | 55| | ||||||||||
| 68 | [69]\\d| | ||||||||||
| 69 | 7[013]| | ||||||||||
| 70 | 81 | ||||||||||
| 71 | )| | ||||||||||
| 72 | 4(?: | ||||||||||
| 73 | 6[03]| | ||||||||||
| 74 | 7[1267]| | ||||||||||
| 75 | 9[0-5] | ||||||||||
| 76 | )| | ||||||||||
| 77 | 5(?: | ||||||||||
| 78 | 3[03489]| | ||||||||||
| 79 | 4[0489]| | ||||||||||
| 80 | 7[1-47]| | ||||||||||
| 81 | 88| | ||||||||||
| 82 | 9[0-49] | ||||||||||
| 83 | )| | ||||||||||
| 84 | 6(?: | ||||||||||
| 85 | 2[1-35]| | ||||||||||
| 86 | 5[149]| | ||||||||||
| 87 | 8[013467] | ||||||||||
| 88 | ) | ||||||||||
| 89 | )\\d{4} | ||||||||||
| 90 | ', | ||||||||||
| 91 | 'geographic' => ' | ||||||||||
| 92 | (?: | ||||||||||
| 93 | 2(?: | ||||||||||
| 94 | 4[0-48]| | ||||||||||
| 95 | 6[0-24]| | ||||||||||
| 96 | 9[0578] | ||||||||||
| 97 | )| | ||||||||||
| 98 | 3(?: | ||||||||||
| 99 | 1[0-35-9]| | ||||||||||
| 100 | 55| | ||||||||||
| 101 | [69]\\d| | ||||||||||
| 102 | 7[013]| | ||||||||||
| 103 | 81 | ||||||||||
| 104 | )| | ||||||||||
| 105 | 4(?: | ||||||||||
| 106 | 6[03]| | ||||||||||
| 107 | 7[1267]| | ||||||||||
| 108 | 9[0-5] | ||||||||||
| 109 | )| | ||||||||||
| 110 | 5(?: | ||||||||||
| 111 | 3[03489]| | ||||||||||
| 112 | 4[0489]| | ||||||||||
| 113 | 7[1-47]| | ||||||||||
| 114 | 88| | ||||||||||
| 115 | 9[0-49] | ||||||||||
| 116 | )| | ||||||||||
| 117 | 6(?: | ||||||||||
| 118 | 2[1-35]| | ||||||||||
| 119 | 5[149]| | ||||||||||
| 120 | 8[013467] | ||||||||||
| 121 | ) | ||||||||||
| 122 | )\\d{4} | ||||||||||
| 123 | ', | ||||||||||
| 124 | 'mobile' => ' | ||||||||||
| 125 | (?: | ||||||||||
| 126 | 321| | ||||||||||
| 127 | 7(?: | ||||||||||
| 128 | [1-8]\\d| | ||||||||||
| 129 | 9[03] | ||||||||||
| 130 | ) | ||||||||||
| 131 | )\\d{5} | ||||||||||
| 132 | ', | ||||||||||
| 133 | 'pager' => '', | ||||||||||
| 134 | 'personal_number' => '', | ||||||||||
| 135 | 'specialrate' => '(90\\d{5})', | ||||||||||
| 136 | 'toll_free' => ' | ||||||||||
| 137 | (?: | ||||||||||
| 138 | 0800| | ||||||||||
| 139 | 800\\d | ||||||||||
| 140 | )\\d{6} | ||||||||||
| 141 | ', | ||||||||||
| 142 | 'voip' => ' | ||||||||||
| 143 | 79(?: | ||||||||||
| 144 | 1(?: | ||||||||||
| 145 | [0-2]\\d| | ||||||||||
| 146 | 3[0-8] | ||||||||||
| 147 | )| | ||||||||||
| 148 | 2[0-7]\\d | ||||||||||
| 149 | )\\d{3} | ||||||||||
| 150 | ' | ||||||||||
| 151 | }; | ||||||||||
| 152 | 2 | my %areanames = (); | |||||||||
| 153 | 2 | $areanames{en} = {"26762", "Kasane", | |||||||||
| 154 | "267391", "Gaborone", | ||||||||||
| 155 | "267534", "Lobatse", | ||||||||||
| 156 | "26729", "Letlhakane\/Orapa", | ||||||||||
| 157 | "26724", "Francistown", | ||||||||||
| 158 | "267393", "Gaborone", | ||||||||||
| 159 | "26758", "Jwaneng", | ||||||||||
| 160 | "267316", "Gaborone", | ||||||||||
| 161 | "267538", "Ramotswa", | ||||||||||
| 162 | "267315", "Gaborone", | ||||||||||
| 163 | "26746", "Serowe", | ||||||||||
| 164 | "267395", "Gaborone", | ||||||||||
| 165 | "267371", "Gaborone", | ||||||||||
| 166 | "267319", "Gaborone", | ||||||||||
| 167 | "267530", "Lobatse", | ||||||||||
| 168 | "267313", "Gaborone", | ||||||||||
| 169 | "267654", "Kgalagadi", | ||||||||||
| 170 | "26754", "Barolong\/Ngwaketse", | ||||||||||
| 171 | "26759", "Molepolole", | ||||||||||
| 172 | "267312", "Gaborone", | ||||||||||
| 173 | "26768", "Maun", | ||||||||||
| 174 | "267651", "Kgalagadi", | ||||||||||
| 175 | "26736", "Gaborone", | ||||||||||
| 176 | "267390", "Gaborone", | ||||||||||
| 177 | "26735", "Gaborone", | ||||||||||
| 178 | "267318", "Gaborone", | ||||||||||
| 179 | "26747", "Mahalapye", | ||||||||||
| 180 | "267317", "Gaborone", | ||||||||||
| 181 | "267659", "Gantsi", | ||||||||||
| 182 | "267397", "Gaborone", | ||||||||||
| 183 | "26757", "Mochudi", | ||||||||||
| 184 | "26726", "Selebi\-Phikwe", | ||||||||||
| 185 | "267310", "Gaborone\ \(outer\)", | ||||||||||
| 186 | "267539", "Ramotswa", | ||||||||||
| 187 | "267533", "Lobatse", | ||||||||||
| 188 | "267370", "Gaborone", | ||||||||||
| 189 | "26749", "Palapye", | ||||||||||
| 190 | "267394", "Gaborone", | ||||||||||
| 191 | "267392", "Gaborone", | ||||||||||
| 192 | "26738", "Gaborone",}; | ||||||||||
| 193 | 2 | my $timezones = { | |||||||||
| 194 | '' => [ | ||||||||||
| 195 | 'Africa/Gaborone' | ||||||||||
| 196 | ] | ||||||||||
| 197 | }; | ||||||||||
| 198 | |||||||||||
| 199 | 16 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 200 | 16 | my $class = shift; | |||||||||
| 201 | 16 | my $number = shift; | |||||||||
| 202 | 16 | $number =~ s/(^\+267|\D)//g; | |||||||||
| 203 | 16 | my $self = bless({ country_code => '267', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 204 | 16 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 205 | } | ||||||||||
| 206 | 2 | 1; | |||||||||