| 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::SM; | ||||||||||
| 20 | 4 | ▶ | use base qw(Number::Phone::StubCountry); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | |||||||||||
| 22 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 4 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 4 | our $VERSION = 1.20260904101551; | |||||||||
| 26 | |||||||||||
| 27 | 4 | my $formatters = [ | |||||||||
| 28 | { | ||||||||||
| 29 | 'format' => '$1', | ||||||||||
| 30 | 'intl_format' => 'NA', | ||||||||||
| 31 | 'leading_digits' => '[89]', | ||||||||||
| 32 | 'pattern' => '(\\d{6})' | ||||||||||
| 33 | }, | ||||||||||
| 34 | { | ||||||||||
| 35 | 'format' => '$1 $2 $3 $4', | ||||||||||
| 36 | 'leading_digits' => '[5-7]', | ||||||||||
| 37 | 'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})' | ||||||||||
| 38 | }, | ||||||||||
| 39 | { | ||||||||||
| 40 | 'format' => '$1 $2', | ||||||||||
| 41 | 'pattern' => '(\\d{4})(\\d{6})' | ||||||||||
| 42 | } | ||||||||||
| 43 | ]; | ||||||||||
| 44 | |||||||||||
| 45 | 4 | my $validators = { | |||||||||
| 46 | 'fixed_line' => ' | ||||||||||
| 47 | 0549(?: | ||||||||||
| 48 | 8[0157-9]| | ||||||||||
| 49 | 9\\d | ||||||||||
| 50 | )\\d{4} | ||||||||||
| 51 | ', | ||||||||||
| 52 | 'geographic' => ' | ||||||||||
| 53 | 0549(?: | ||||||||||
| 54 | 8[0157-9]| | ||||||||||
| 55 | 9\\d | ||||||||||
| 56 | )\\d{4} | ||||||||||
| 57 | ', | ||||||||||
| 58 | 'mobile' => '6[16]\\d{6}', | ||||||||||
| 59 | 'pager' => '', | ||||||||||
| 60 | 'personal_number' => '', | ||||||||||
| 61 | 'specialrate' => '(7[178]\\d{6})', | ||||||||||
| 62 | 'toll_free' => '', | ||||||||||
| 63 | 'voip' => '5[158]\\d{6}' | ||||||||||
| 64 | }; | ||||||||||
| 65 | 4 | my $timezones = { | |||||||||
| 66 | '' => [ | ||||||||||
| 67 | 'Europe/San_Marino' | ||||||||||
| 68 | ] | ||||||||||
| 69 | }; | ||||||||||
| 70 | |||||||||||
| 71 | 27 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 72 | 27 | my $class = shift; | |||||||||
| 73 | 27 | my $number = shift; | |||||||||
| 74 | 27 | $number =~ s/(^\+378|\D)//g; | |||||||||
| 75 | 27 | my $self = bless({ country_code => '378', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, }, $class); | |||||||||
| 76 | 27 | ▶ | return $self if ($self->is_valid()); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 77 | 11 | my $prefix = qr/^(?:([89]\d{5})$)/; | |||||||||
| 78 | 11 | my @matches = $number =~ /$prefix/; | |||||||||
| 79 | 11 | ▶ | if (defined $matches[-1]) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | 4 | ▶ | no warnings 'uninitialized'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 81 | 9 | $number =~ s/$prefix/0549$1/; | |||||||||
| 82 | } | ||||||||||
| 83 | else { | ||||||||||
| 84 | 2 | $number =~ s/$prefix//; | |||||||||
| 85 | } | ||||||||||
| 86 | 11 | $self = bless({ country_code => '378', number => $number, formatters => $formatters, validators => $validators, }, $class); | |||||||||
| 87 | 11 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | } | ||||||||||
| 89 | 4 | 1; | |||||||||