| 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::CU; | ||||||||||
| 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.20260904101549; | |||||||||
| 26 | |||||||||||
| 27 | 2 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1 $2', | ||||||||||
| 30 | 'leading_digits' => ' | ||||||||||
| 31 | 2[1-4]| | ||||||||||
| 32 | [34] | ||||||||||
| 33 | ', | ||||||||||
| 34 | 'national_rule' => '(0$1)', | ||||||||||
| 35 | 'pattern' => '(\\d{2})(\\d{4,6})' | ||||||||||
| 36 | }, | ||||||||||
| 37 | { | ||||||||||
| 38 | 'format' => '$1 $2', | ||||||||||
| 39 | 'leading_digits' => '7', | ||||||||||
| 40 | 'national_rule' => '(0$1)', | ||||||||||
| 41 | 'pattern' => '(\\d)(\\d{6,7})' | ||||||||||
| 42 | }, | ||||||||||
| 43 | { | ||||||||||
| 44 | 'format' => '$1 $2', | ||||||||||
| 45 | 'leading_digits' => '[56]', | ||||||||||
| 46 | 'national_rule' => '0$1', | ||||||||||
| 47 | 'pattern' => '(\\d)(\\d{7})' | ||||||||||
| 48 | }, | ||||||||||
| 49 | { | ||||||||||
| 50 | 'format' => '$1 $2', | ||||||||||
| 51 | 'leading_digits' => '8', | ||||||||||
| 52 | 'national_rule' => '0$1', | ||||||||||
| 53 | 'pattern' => '(\\d{3})(\\d{7})' | ||||||||||
| 54 | } | ||||||||||
| 55 | ]; | ||||||||||
| 56 | |||||||||||
| 57 | 2 | my $validators = { | |||||||||
| 58 | 'fixed_line' => ' | ||||||||||
| 59 | (?: | ||||||||||
| 60 | 3[23]| | ||||||||||
| 61 | 4[89] | ||||||||||
| 62 | )\\d{4,6}| | ||||||||||
| 63 | (?: | ||||||||||
| 64 | 31| | ||||||||||
| 65 | 4[36]| | ||||||||||
| 66 | 8(?: | ||||||||||
| 67 | 0[25]| | ||||||||||
| 68 | 78 | ||||||||||
| 69 | )\\d | ||||||||||
| 70 | )\\d{6}| | ||||||||||
| 71 | (?: | ||||||||||
| 72 | 2[1-4]| | ||||||||||
| 73 | 4[1257]| | ||||||||||
| 74 | 7\\d | ||||||||||
| 75 | )\\d{5,6} | ||||||||||
| 76 | ', | ||||||||||
| 77 | 'geographic' => ' | ||||||||||
| 78 | (?: | ||||||||||
| 79 | 3[23]| | ||||||||||
| 80 | 4[89] | ||||||||||
| 81 | )\\d{4,6}| | ||||||||||
| 82 | (?: | ||||||||||
| 83 | 31| | ||||||||||
| 84 | 4[36]| | ||||||||||
| 85 | 8(?: | ||||||||||
| 86 | 0[25]| | ||||||||||
| 87 | 78 | ||||||||||
| 88 | )\\d | ||||||||||
| 89 | )\\d{6}| | ||||||||||
| 90 | (?: | ||||||||||
| 91 | 2[1-4]| | ||||||||||
| 92 | 4[1257]| | ||||||||||
| 93 | 7\\d | ||||||||||
| 94 | )\\d{5,6} | ||||||||||
| 95 | ', | ||||||||||
| 96 | 'mobile' => ' | ||||||||||
| 97 | (?: | ||||||||||
| 98 | 5\\d| | ||||||||||
| 99 | 6[2-4] | ||||||||||
| 100 | )\\d{6} | ||||||||||
| 101 | ', | ||||||||||
| 102 | 'pager' => '', | ||||||||||
| 103 | 'personal_number' => '', | ||||||||||
| 104 | 'specialrate' => '(807\\d{7})', | ||||||||||
| 105 | 'toll_free' => '800\\d{7}', | ||||||||||
| 106 | 'voip' => '' | ||||||||||
| 107 | }; | ||||||||||
| 108 | 2 | my %areanames = (); | |||||||||
| 109 | 2 | $areanames{en} = {"5321", "Guantánamo\ Province", | |||||||||
| 110 | "5323", "Granma\ Province", | ||||||||||
| 111 | "5343", "Cienfuegos\ Province", | ||||||||||
| 112 | "5348", "Pinar\ del\ Río\ Province", | ||||||||||
| 113 | "5341", "Sancti\ Spíritus\ Province", | ||||||||||
| 114 | "5333", "Ciego\ de\ Ávila\ Province", | ||||||||||
| 115 | "5331", "Las\ Tunas\ Province", | ||||||||||
| 116 | "5324", "Holguín\ Province", | ||||||||||
| 117 | "537", "Havana\ City", | ||||||||||
| 118 | "5347", "Mayabeque\ and\ Artemisa", | ||||||||||
| 119 | "5346", "Isle\ of\ Youth", | ||||||||||
| 120 | "5322", "Santiago\ de\ Cuba\ Province", | ||||||||||
| 121 | "5349", "Artemisa\ Province", | ||||||||||
| 122 | "5342", "Villa\ Clara\ Province", | ||||||||||
| 123 | "5332", "Camagüey\ Province", | ||||||||||
| 124 | "5345", "Matanzas\ Province",}; | ||||||||||
| 125 | 2 | my $timezones = { | |||||||||
| 126 | '' => [ | ||||||||||
| 127 | 'America/Havana' | ||||||||||
| 128 | ] | ||||||||||
| 129 | }; | ||||||||||
| 130 | |||||||||||
| 131 | 13 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 132 | 13 | my $class = shift; | |||||||||
| 133 | 13 | my $number = shift; | |||||||||
| 134 | 13 | $number =~ s/(^\+53|\D)//g; | |||||||||
| 135 | 13 | my $self = bless({ country_code => '53', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, areanames => \%areanames}, $class); | |||||||||
| 136 | 13 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 137 | 1 | $number =~ s/^(?:0)//; | |||||||||
| 138 | 1 | $self = bless({ country_code => '53', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); | |||||||||
| 139 | 1 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 140 | } | ||||||||||
| 141 | 2 | 1; | |||||||||