File Coverage

blib/lib/Number/Phone/StubCountry/InternationalNetworks883.pm
Criterion Covered Total %
statement 17 17 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             # automatically generated file, don't edit
2              
3              
4              
5             # Copyright 2023 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::InternationalNetworks883;
20 3     3   1502 use base qw(Number::Phone::StubCountry);
  3         9  
  3         319  
21              
22 3     3   21 use strict;
  3         8  
  3         75  
23 3     3   28 use warnings;
  3         9  
  3         133  
24 3     3   19 use utf8;
  3         8  
  3         17  
25             our $VERSION = 1.20230307181423;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '
31             [14]|
32             2[24-689]|
33             3[02-689]|
34             51[24-9]
35             ',
36             'pattern' => '(\\d{3})(\\d{3})(\\d{2,8})'
37             },
38             {
39             'format' => '$1 $2 $3',
40             'leading_digits' => '510',
41             'pattern' => '(\\d{3})(\\d{3})(\\d{3})'
42             },
43             {
44             'format' => '$1 $2 $3',
45             'leading_digits' => '21',
46             'pattern' => '(\\d{3})(\\d{3})(\\d{4})'
47             },
48             {
49             'format' => '$1 $2 $3',
50             'leading_digits' => '51[13]',
51             'pattern' => '(\\d{4})(\\d{4})(\\d{4})'
52             },
53             {
54             'format' => '$1 $2 $3 $4',
55             'leading_digits' => '[235]',
56             'pattern' => '(\\d{3})(\\d{3})(\\d{3})(\\d{3})'
57             }
58             ];
59              
60             my $validators = {
61             'fixed_line' => '',
62             'geographic' => '',
63             'mobile' => '',
64             'pager' => '',
65             'personal_number' => '',
66             'specialrate' => '',
67             'toll_free' => '',
68             'voip' => '
69             (?:
70             2(?:
71             00\\d\\d|
72             10
73             )|
74             (?:
75             370[1-9]|
76             51\\d0
77             )\\d
78             )\\d{7}|
79             51(?:
80             00\\d{5}|
81             [24-9]0\\d{4,7}
82             )|
83             (?:
84             1[013-79]|
85             2[24-689]|
86             3[02-689]|
87             4[0-4]
88             )0\\d{5,9}
89             '
90             };
91              
92             sub new {
93 19     19 1 53 my $class = shift;
94 19         49 my $number = shift;
95 19         154 $number =~ s/(^\+883|\D)//g;
96 19         108 my $self = bless({ country_code => '883', number => $number, formatters => $formatters, validators => $validators, }, $class);
97 19 100       107 return $self->is_valid() ? $self : undef;
98             }
99             1;