| 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::AF; | ||||||||||
| 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.20260904101547; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2', | ||||||||||
| 30 | 'intl_format' => 'NA', | ||||||||||
| 31 | 'leading_digits' => '[1-9]', | ||||||||||
| 32 | 'pattern' => '(\\d{3})(\\d{4})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3', | ||||||||||
| 36 | 'leading_digits' => '[2-7]', | ||||||||||
| 37 | 'national_rule' => '0$1', | ||||||||||
| 38 | 'pattern' => '(\\d{2})(\\d{3})(\\d{4})' | ||||||||||
| 39 | } | ||||||||||
| 40 | ]; | ||||||||||
| 41 | |||||||||||
| 42 | 2 | my $validators = { | |||||||||
| 43 | 'fixed_line' => ' | ||||||||||
| 44 | (?: | ||||||||||
| 45 | [25][0-8]| | ||||||||||
| 46 | [34][0-4]| | ||||||||||
| 47 | 6[0-5] | ||||||||||
| 48 | )[2-9]\\d{6} | ||||||||||
| 49 | ', | ||||||||||
| 50 | 'geographic' => ' | ||||||||||
| 51 | (?: | ||||||||||
| 52 | [25][0-8]| | ||||||||||
| 53 | [34][0-4]| | ||||||||||
| 54 | 6[0-5] | ||||||||||
| 55 | )[2-9]\\d{6} | ||||||||||
| 56 | ', | ||||||||||
| 57 | 'mobile' => '7\\d{8}', | ||||||||||
| 58 | 'pager' => '', | ||||||||||
| 59 | 'personal_number' => '', | ||||||||||
| 60 | 'specialrate' => '', | ||||||||||
| 61 | 'toll_free' => '', | ||||||||||
| 62 | 'voip' => '' | ||||||||||
| 63 | }; | ||||||||||
| 64 | 2 | my %areanames = (); | |||||||||
| 65 | 2 | $areanames{fa} = {"9360", "ننگرهار", | |||||||||
| 66 | "9350", "بلخ", | ||||||||||
| 67 | "9358", "بغلان", | ||||||||||
| 68 | "9351", "قندوز", | ||||||||||
| 69 | "9361", "نورستان", | ||||||||||
| 70 | "9354", "جوزجان", | ||||||||||
| 71 | "9325", "لوگر", | ||||||||||
| 72 | "9364", "پکتیا", | ||||||||||
| 73 | "9340", "هرات", | ||||||||||
| 74 | "9365", "پکتیکا", | ||||||||||
| 75 | "9330", "قندهار", | ||||||||||
| 76 | "9324", "وردک", | ||||||||||
| 77 | "9355", "سمنگان", | ||||||||||
| 78 | "9341", "بادغیس", | ||||||||||
| 79 | "9331", "غزنی", | ||||||||||
| 80 | "9328", "پنجشیر", | ||||||||||
| 81 | "9321", "پروان", | ||||||||||
| 82 | "9320", "کابل", | ||||||||||
| 83 | "9344", "نیمروز", | ||||||||||
| 84 | "9334", "هلمند", | ||||||||||
| 85 | "9326", "دایکندی", | ||||||||||
| 86 | "9327", "خوست", | ||||||||||
| 87 | "9353", "تخار", | ||||||||||
| 88 | "9342", "غور", | ||||||||||
| 89 | "9363", "لغمان", | ||||||||||
| 90 | "9332", "ارزگان", | ||||||||||
| 91 | "9322", "کاپیسا", | ||||||||||
| 92 | "9352", "بدخشان", | ||||||||||
| 93 | "9362", "کنرها", | ||||||||||
| 94 | "9343", "فراه", | ||||||||||
| 95 | "9333", "زابل", | ||||||||||
| 96 | "9323", "بامیان", | ||||||||||
| 97 | "9357", "فاریاب", | ||||||||||
| 98 | "9356", "سر\ پل",}; | ||||||||||
| 99 | 2 | $areanames{en} = {"9365", "Paktika", | |||||||||
| 100 | "9340", "Heart", | ||||||||||
| 101 | "9330", "Kandahar", | ||||||||||
| 102 | "9324", "Wardak", | ||||||||||
| 103 | "9355", "Samangan", | ||||||||||
| 104 | "9331", "Ghazni", | ||||||||||
| 105 | "9341", "Badghis", | ||||||||||
| 106 | "9328", "Panjshar", | ||||||||||
| 107 | "9321", "Parwan", | ||||||||||
| 108 | "9320", "Kabul", | ||||||||||
| 109 | "9334", "Helmand", | ||||||||||
| 110 | "9344", "Nimruz", | ||||||||||
| 111 | "9360", "Nangarhar", | ||||||||||
| 112 | "9350", "Balkh", | ||||||||||
| 113 | "9351", "Kunduz", | ||||||||||
| 114 | "9358", "Baghlan", | ||||||||||
| 115 | "9361", "Nurestan", | ||||||||||
| 116 | "9354", "Jowzjan", | ||||||||||
| 117 | "9325", "Logar", | ||||||||||
| 118 | "9364", "Paktia", | ||||||||||
| 119 | "9352", "Badkhshan", | ||||||||||
| 120 | "9343", "Farah", | ||||||||||
| 121 | "9362", "Kunarha", | ||||||||||
| 122 | "9333", "Zabol", | ||||||||||
| 123 | "9323", "Bamian", | ||||||||||
| 124 | "9357", "Faryab", | ||||||||||
| 125 | "9356", "Sar\-E\ Pol", | ||||||||||
| 126 | "9326", "Dorkondi", | ||||||||||
| 127 | "9327", "Khost", | ||||||||||
| 128 | "9353", "Takhar", | ||||||||||
| 129 | "9363", "Laghman", | ||||||||||
| 130 | "9342", "Ghowr", | ||||||||||
| 131 | "9332", "Uruzgan", | ||||||||||
| 132 | "9322", "Kapisa",}; | ||||||||||
| 133 | 2 | my $timezones = { | |||||||||
| 134 | '' => [ | ||||||||||
| 135 | 'Asia/Kabul' | ||||||||||
| 136 | ] | ||||||||||
| 137 | }; | ||||||||||
| 138 | |||||||||||
| 139 | 7 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 140 | 7 | my $class = shift; | |||||||||
| 141 | 7 | my $number = shift; | |||||||||
| 142 | 7 | $number =~ s/(^\+93|\D)//g; | |||||||||
| 143 | 7 | my $self = bless({ country_code => '93', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 144 | 7 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 145 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 146 | 1 | $self = bless({ country_code => '93', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 147 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 148 | } | ||||||||||
| 149 | 2 | 1; | |||||||||