| 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::SG; | ||||||||||
| 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', | ||||||||||
| 30 | 'intl_format' => 'NA', | ||||||||||
| 31 | 'leading_digits' => ' | ||||||||||
| 32 | 1(?: | ||||||||||
| 33 | [013-8]| | ||||||||||
| 34 | 9(?: | ||||||||||
| 35 | 0[1-9]| | ||||||||||
| 36 | [1-9] | ||||||||||
| 37 | ) | ||||||||||
| 38 | )| | ||||||||||
| 39 | 77 | ||||||||||
| 40 | ', | ||||||||||
| 41 | 'pattern' => '(\\d{4,5})' | ||||||||||
| 42 | }, | ||||||||||
| 43 | { | ||||||||||
| 44 | 'format' => '$1 $2', | ||||||||||
| 45 | 'leading_digits' => ' | ||||||||||
| 46 | [369]| | ||||||||||
| 47 | 8(?: | ||||||||||
| 48 | 0[1-9]| | ||||||||||
| 49 | [1-9] | ||||||||||
| 50 | ) | ||||||||||
| 51 | ', | ||||||||||
| 52 | 'pattern' => '(\\d{4})(\\d{4})' | ||||||||||
| 53 | }, | ||||||||||
| 54 | { | ||||||||||
| 55 | 'format' => '$1 $2 $3', | ||||||||||
| 56 | 'leading_digits' => '8', | ||||||||||
| 57 | 'pattern' => '(\\d{3})(\\d{3})(\\d{4})' | ||||||||||
| 58 | }, | ||||||||||
| 59 | { | ||||||||||
| 60 | 'format' => '$1 $2 $3', | ||||||||||
| 61 | 'leading_digits' => '7', | ||||||||||
| 62 | 'pattern' => '(\\d{4})(\\d{4})(\\d{3})' | ||||||||||
| 63 | }, | ||||||||||
| 64 | { | ||||||||||
| 65 | 'format' => '$1 $2 $3', | ||||||||||
| 66 | 'leading_digits' => '1', | ||||||||||
| 67 | 'pattern' => '(\\d{4})(\\d{3})(\\d{4})' | ||||||||||
| 68 | } | ||||||||||
| 69 | ]; | ||||||||||
| 70 | |||||||||||
| 71 | 2 | my $validators = { | |||||||||
| 72 | 'fixed_line' => ' | ||||||||||
| 73 | 662[0-24-9]\\d{4}| | ||||||||||
| 74 | 6(?: | ||||||||||
| 75 | [0-578]\\d| | ||||||||||
| 76 | 6[013-57-9]| | ||||||||||
| 77 | 9[0-35-9] | ||||||||||
| 78 | )\\d{5} | ||||||||||
| 79 | ', | ||||||||||
| 80 | 'geographic' => ' | ||||||||||
| 81 | 662[0-24-9]\\d{4}| | ||||||||||
| 82 | 6(?: | ||||||||||
| 83 | [0-578]\\d| | ||||||||||
| 84 | 6[013-57-9]| | ||||||||||
| 85 | 9[0-35-9] | ||||||||||
| 86 | )\\d{5} | ||||||||||
| 87 | ', | ||||||||||
| 88 | 'mobile' => ' | ||||||||||
| 89 | 80[1-9]\\d{5}| | ||||||||||
| 90 | (?: | ||||||||||
| 91 | 8[1-9]| | ||||||||||
| 92 | 9[0-8] | ||||||||||
| 93 | )\\d{6} | ||||||||||
| 94 | ', | ||||||||||
| 95 | 'pager' => '', | ||||||||||
| 96 | 'personal_number' => '', | ||||||||||
| 97 | 'specialrate' => '(1900\\d{7})|(7000\\d{7})', | ||||||||||
| 98 | 'toll_free' => ' | ||||||||||
| 99 | (?: | ||||||||||
| 100 | 18| | ||||||||||
| 101 | 8 | ||||||||||
| 102 | )00\\d{7} | ||||||||||
| 103 | ', | ||||||||||
| 104 | 'voip' => ' | ||||||||||
| 105 | (?: | ||||||||||
| 106 | 3[12]\\d| | ||||||||||
| 107 | 666 | ||||||||||
| 108 | )\\d{5} | ||||||||||
| 109 | ' | ||||||||||
| 110 | }; | ||||||||||
| 111 | 2 | my $timezones = { | |||||||||
| 112 | '' => [ | ||||||||||
| 113 | 'Asia/Singapore' | ||||||||||
| 114 | ] | ||||||||||
| 115 | }; | ||||||||||
| 116 | |||||||||||
| 117 | 19 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 118 | 19 | my $class = shift; | |||||||||
| 119 | 19 | my $number = shift; | |||||||||
| 120 | 19 | $number =~ s/(^\+65|\D)//g; | |||||||||
| 121 | 19 | my $self = bless({ country_code => '65', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, }, $class); | |||||||||
| 122 | 19 | ▶ | return $self->is_valid() ? $self : undef; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | } | ||||||||||
| 124 | 2 | 1; | |||||||||