File Coverage

blib/lib/Number/Phone/StubCountry/MF.pm
Criterion Covered Total %
statement 20 20 100.0
branch 3 4 75.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 29 30 96.6


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::MF;
20 3     3   1442 use base qw(Number::Phone::StubCountry);
  3         10  
  3         302  
21              
22 3     3   22 use strict;
  3         7  
  3         64  
23 3     3   15 use warnings;
  3         7  
  3         85  
24 3     3   17 use utf8;
  3         9  
  3         18  
25             our $VERSION = 1.20230307181421;
26              
27             my $formatters = [];
28              
29             my $validators = {
30             'fixed_line' => '
31             590(?:
32             0[079]|
33             [14]3|
34             [27][79]|
35             30|
36             5[0-268]|
37             87
38             )\\d{4}
39             ',
40             'geographic' => '
41             590(?:
42             0[079]|
43             [14]3|
44             [27][79]|
45             30|
46             5[0-268]|
47             87
48             )\\d{4}
49             ',
50             'mobile' => '
51             69(?:
52             0\\d\\d|
53             1(?:
54             2[2-9]|
55             3[0-5]
56             )
57             )\\d{4}
58             ',
59             'pager' => '',
60             'personal_number' => '',
61             'specialrate' => '',
62             'toll_free' => '80[0-5]\\d{6}',
63             'voip' => '976[01]\\d{5}'
64             };
65              
66             sub new {
67 10     10 1 32 my $class = shift;
68 10         20 my $number = shift;
69 10         65 $number =~ s/(^\+590|\D)//g;
70 10         46 my $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
71 10 100       48 return $self if ($self->is_valid());
72 2         9 $number =~ s/^(?:0)//;
73 2         27 $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
74 2 50       7 return $self->is_valid() ? $self : undef;
75             }
76             1;