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   1522 use base qw(Number::Phone::StubCountry);
  3         7  
  3         353  
21              
22 3     3   30 use strict;
  3         9  
  3         66  
23 3     3   18 use warnings;
  3         7  
  3         84  
24 3     3   18 use utf8;
  3         8  
  3         51  
25             our $VERSION = 1.20230903131448;
26              
27             my $formatters = [];
28              
29             my $validators = {
30             'fixed_line' => '
31             590(?:
32             0[079]|
33             [14]3|
34             [27][79]|
35             3[03-7]|
36             5[0-268]|
37             87
38             )\\d{4}
39             ',
40             'geographic' => '
41             590(?:
42             0[079]|
43             [14]3|
44             [27][79]|
45             3[03-7]|
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' => '
64             9(?:
65             (?:
66             395|
67             76[018]
68             )\\d|
69             475[0-5]
70             )\\d{4}
71             '
72             };
73              
74             sub new {
75 10     10 1 32 my $class = shift;
76 10         22 my $number = shift;
77 10         72 $number =~ s/(^\+590|\D)//g;
78 10         56 my $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
79 10 100       58 return $self if ($self->is_valid());
80 2         12 $number =~ s/^(?:0)//;
81 2         25 $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
82 2 50       11 return $self->is_valid() ? $self : undef;
83             }
84             1;