blib/lib/Number/Phone/StubCountry/MY.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 97.1% 34 / 35 CC 3 SCAR 6.2
CC
3
Cov
97%
new
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/Number/Phone/StubCountry/MW.pm ↑ Summary blib/lib/Number/Phone/StubCountry/NP.pm »
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::MY;
20 3 ▶use base qw(Number::Phone::StubCountry);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 our $VERSION = 1.20260904101550;
26  
27 3 my $formatters = [
28 {
29 'format' => '$1-$2 $3',
30 'leading_digits' => '[4-79]',
31 'national_rule' => '0$1',
32 'pattern' => '(\\d)(\\d{3})(\\d{4})'
33 },
34 {
35 'format' => '$1-$2 $3',
36 'leading_digits' => '
37 1(?:
38 [02469]|
39 [37][1-9]|
40 53|
41 8(?:
42 [1-46-9]|
43 5[7-9]
44 )
45 )|
46 8
47 ',
48 'national_rule' => '0$1',
49 'pattern' => '(\\d{2})(\\d{3})(\\d{3,4})'
50 },
51 {
52 'format' => '$1-$2 $3',
53 'leading_digits' => '3',
54 'national_rule' => '0$1',
55 'pattern' => '(\\d)(\\d{4})(\\d{4})'
56 },
57 {
58 'format' => '$1-$2-$3-$4',
59 'leading_digits' => '
60 1(?:
61 [367]|
62 80
63 )
64 ',
65 'pattern' => '(\\d)(\\d{3})(\\d{2})(\\d{4})'
66 },
67 {
68 'format' => '$1-$2 $3',
69 'leading_digits' => '15',
70 'national_rule' => '0$1',
71 'pattern' => '(\\d{3})(\\d{3})(\\d{4})'
72 },
73 {
74 'format' => '$1-$2 $3',
75 'leading_digits' => '1',
76 'national_rule' => '0$1',
77 'pattern' => '(\\d{2})(\\d{4})(\\d{4})'
78 }
79 ];
80  
81 3 my $validators = {
82 'fixed_line' => '
83 427[01]\\d{4}|
84 (?:
85 3(?:
86 2[0-36-9]|
87 3[0-368]|
88 4[0-278]|
89 5[0-24-8]|
90 6[0-467]|
91 7[1246-9]|
92 8\\d|
93 9[0-57]
94 )\\d|
95 4(?:
96 2[0-689]|
97 [3-79]\\d|
98 8[1-35689]
99 )|
100 5(?:
101 2[0-589]|
102 [3468]\\d|
103 5[0-489]|
104 7[1-9]|
105 9[23]
106 )|
107 6(?:
108 2[2-9]|
109 3[1357-9]|
110 [46]\\d|
111 5[0-6]|
112 7[0-35-9]|
113 85|
114 9[015-8]
115 )|
116 7(?:
117 [2579]\\d|
118 3[03-68]|
119 4[0-8]|
120 6[5-9]|
121 8[0-35-9]
122 )|
123 8(?:
124 [24][2-8]|
125 3[2-5]|
126 5[2-7]|
127 6[2-589]|
128 7[2-578]|
129 [89][2-9]
130 )|
131 9(?:
132 0[57]|
133 13|
134 [25-7]\\d|
135 [3489][0-8]
136 )
137 )\\d{5}
138 ',
139 'geographic' => '
140 427[01]\\d{4}|
141 (?:
142 3(?:
143 2[0-36-9]|
144 3[0-368]|
145 4[0-278]|
146 5[0-24-8]|
147 6[0-467]|
148 7[1246-9]|
149 8\\d|
150 9[0-57]
151 )\\d|
152 4(?:
153 2[0-689]|
154 [3-79]\\d|
155 8[1-35689]
156 )|
157 5(?:
158 2[0-589]|
159 [3468]\\d|
160 5[0-489]|
161 7[1-9]|
162 9[23]
163 )|
164 6(?:
165 2[2-9]|
166 3[1357-9]|
167 [46]\\d|
168 5[0-6]|
169 7[0-35-9]|
170 85|
171 9[015-8]
172 )|
173 7(?:
174 [2579]\\d|
175 3[03-68]|
176 4[0-8]|
177 6[5-9]|
178 8[0-35-9]
179 )|
180 8(?:
181 [24][2-8]|
182 3[2-5]|
183 5[2-7]|
184 6[2-589]|
185 7[2-578]|
186 [89][2-9]
187 )|
188 9(?:
189 0[57]|
190 13|
191 [25-7]\\d|
192 [3489][0-8]
193 )
194 )\\d{5}
195 ',
196 'mobile' => '
197 1(?:
198 (?:
199 1888[689]|
200 4400|
201 8(?:
202 47|
203 8[27]
204 )[0-4]
205 )\\d{4}|
206 9\\d{7,8}
207 )|
208 1(?:
209 0(?:
210 [23568]\\d|
211 4[0-6]|
212 7[016-9]|
213 9[0-8]
214 )|
215 1(?:
216 [1-5]\\d\\d|
217 6(?:
218 0[5-9]|
219 [1-9]\\d
220 )|
221 7(?:
222 [0-4]\\d|
223 5[0-79]|
224 6[02-4]|
225 8[02-5]
226 )
227 )|
228 (?:
229 [26]\\d|
230 [37][1-9]|
231 4[235-9]
232 )\\d|
233 5(?:
234 31|
235 9\\d\\d
236 )|
237 8(?:
238 1[23]|
239 [236]\\d|
240 4[06]|
241 5(?:
242 46|
243 [7-9]
244 )|
245 7[016-9]|
246 8[01]|
247 9[0-8]
248 )
249 )\\d{5}
250 ',
251 'pager' => '',
252 'personal_number' => '',
253 'specialrate' => '(1600\\d{6})',
254 'toll_free' => '1[378]00\\d{6}',
255 'voip' => '
256 15(?:
257 4(?:
258 6[0-4]\\d|
259 8(?:
260 0[125]|
261 [17]\\d|
262 21|
263 3[01]|
264 4[01589]|
265 5[014]|
266 6[02]
267 )
268 )|
269 6(?:
270 32[0-6]|
271 78\\d
272 )
273 )\\d{4}
274 '
275 };
276 3 my $timezones = {
277 '' => [
278 'Asia/Kuching'
279 ]
280 };
281  
282 17 ▶ sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
283 17 my $class = shift;
284 17 my $number = shift;
285 17 $number =~ s/(^\+60|\D)//g;
286 17 my $self = bless({ country_code => '60', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, }, $class);
287 17 ▶ return $self if ($self->is_valid());
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_valid 16 1 17
288 1 $number =~ s/^(?:0)//;
289 1 $self = bless({ country_code => '60', number => $number, formatters => $formatters, validators => $validators, }, $class);
290 1 ▶ return $self->is_valid() ? $self : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 0 1 1
291 }
292 3 1;
« blib/lib/Number/Phone/StubCountry/MW.pm ↑ Summary blib/lib/Number/Phone/StubCountry/NP.pm »