| 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::SA; | ||||||||||
| 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' => '9', | ||||||||||
| 31 | 'pattern' => '(\\d{4})(\\d{5})' | ||||||||||
| 32 | }, | ||||||||||
| 33 | { | ||||||||||
| 34 | 'format' => '$1 $2 $3', | ||||||||||
| 35 | 'leading_digits' => '1', | ||||||||||
| 36 | 'national_rule' => '0$1', | ||||||||||
| 37 | 'pattern' => '(\\d{2})(\\d{3})(\\d{4})' | ||||||||||
| 38 | }, | ||||||||||
| 39 | { | ||||||||||
| 40 | 'format' => '$1 $2 $3', | ||||||||||
| 41 | 'leading_digits' => '5', | ||||||||||
| 42 | 'national_rule' => '0$1', | ||||||||||
| 43 | 'pattern' => '(\\d{2})(\\d{3})(\\d{4})' | ||||||||||
| 44 | }, | ||||||||||
| 45 | { | ||||||||||
| 46 | 'format' => '$1 $2 $3', | ||||||||||
| 47 | 'leading_digits' => '8', | ||||||||||
| 48 | 'pattern' => '(\\d{3})(\\d{3})(\\d{4})' | ||||||||||
| 49 | } | ||||||||||
| 50 | ]; | ||||||||||
| 51 | |||||||||||
| 52 | 2 | my $validators = { | |||||||||
| 53 | 'fixed_line' => ' | ||||||||||
| 54 | 1(?: | ||||||||||
| 55 | 1\\d| | ||||||||||
| 56 | 2[24-8]| | ||||||||||
| 57 | 3[35-8]| | ||||||||||
| 58 | 4[3-68]| | ||||||||||
| 59 | 6[2-5]| | ||||||||||
| 60 | 7[235-7] | ||||||||||
| 61 | )\\d{6} | ||||||||||
| 62 | ', | ||||||||||
| 63 | 'geographic' => ' | ||||||||||
| 64 | 1(?: | ||||||||||
| 65 | 1\\d| | ||||||||||
| 66 | 2[24-8]| | ||||||||||
| 67 | 3[35-8]| | ||||||||||
| 68 | 4[3-68]| | ||||||||||
| 69 | 6[2-5]| | ||||||||||
| 70 | 7[235-7] | ||||||||||
| 71 | )\\d{6} | ||||||||||
| 72 | ', | ||||||||||
| 73 | 'mobile' => ' | ||||||||||
| 74 | 579[0-8]\\d{5}| | ||||||||||
| 75 | 5(?: | ||||||||||
| 76 | [013-689]\\d| | ||||||||||
| 77 | 7[0-8] | ||||||||||
| 78 | )\\d{6} | ||||||||||
| 79 | ', | ||||||||||
| 80 | 'pager' => '', | ||||||||||
| 81 | 'personal_number' => '', | ||||||||||
| 82 | 'specialrate' => '(920\\d{6})|(925\\d{6})', | ||||||||||
| 83 | 'toll_free' => '800\\d{7}', | ||||||||||
| 84 | 'voip' => '' | ||||||||||
| 85 | }; | ||||||||||
| 86 | 2 | my %areanames = (); | |||||||||
| 87 | 2 | $areanames{ar} = {"96616", "حائل\/القصيم", | |||||||||
| 88 | "96613", "الدمام\/الخبر\/الظهران", | ||||||||||
| 89 | "96614", "المدينة\ المنورة\/عرعر\/تبوك\/ينبع\ البحر", | ||||||||||
| 90 | "96617", "أبها\/نجران\/جازان", | ||||||||||
| 91 | "96611", "الرياض\/الخرج", | ||||||||||
| 92 | "96612", "مكة\/جدة",}; | ||||||||||
| 93 | 2 | $areanames{en} = {"96611", "Riyadh\/Kharj", | |||||||||
| 94 | "96612", "Makkah\/Jeddah", | ||||||||||
| 95 | "96617", "Abha\/Najran\/Jezan", | ||||||||||
| 96 | "96616", "Hail\/Qasim", | ||||||||||
| 97 | "96613", "Dammam\/Khobar\/Dahran", | ||||||||||
| 98 | "96614", "Madenah\/Arar\/Tabuk\/Yanbu",}; | ||||||||||
| 99 | 2 | my $timezones = { | |||||||||
| 100 | '' => [ | ||||||||||
| 101 | 'Asia/Riyadh' | ||||||||||
| 102 | ] | ||||||||||
| 103 | }; | ||||||||||
| 104 | |||||||||||
| 105 | 16 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 106 | 16 | my $class = shift; | |||||||||
| 107 | 16 | my $number = shift; | |||||||||
| 108 | 16 | $number =~ s/(^\+966|\D)//g; | |||||||||
| 109 | 16 | my $self = bless({ country_code => '966', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 110 | 16 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 111 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 112 | 1 | $self = bless({ country_code => '966', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 113 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 114 | } | ||||||||||
| 115 | 2 | 1; | |||||||||