File Coverage

blib/lib/Number/Phone/StubCountry/MH.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::MH;
20 2     2   1156 use base qw(Number::Phone::StubCountry);
  2         5  
  2         250  
21              
22 2     2   16 use strict;
  2         6  
  2         46  
23 2     2   13 use warnings;
  2         4  
  2         60  
24 2     2   11 use utf8;
  2         7  
  2         11  
25             our $VERSION = 1.20230903131448;
26              
27             my $formatters = [
28             {
29             'format' => '$1-$2',
30             'leading_digits' => '[2-6]',
31             'pattern' => '(\\d{3})(\\d{4})'
32             }
33             ];
34              
35             my $validators = {
36             'fixed_line' => '
37             (?:
38             247|
39             45[78]|
40             528|
41             625
42             )\\d{4}
43             ',
44             'geographic' => '
45             (?:
46             247|
47             45[78]|
48             528|
49             625
50             )\\d{4}
51             ',
52             'mobile' => '
53             (?:
54             (?:
55             23|
56             54
57             )5|
58             329|
59             45[356]
60             )\\d{4}
61             ',
62             'pager' => '',
63             'personal_number' => '',
64             'specialrate' => '',
65             'toll_free' => '',
66             'voip' => '635\\d{4}'
67             };
68              
69             sub new {
70 10     10 1 24 my $class = shift;
71 10         22 my $number = shift;
72 10         59 $number =~ s/(^\+692|\D)//g;
73 10         49 my $self = bless({ country_code => '692', number => $number, formatters => $formatters, validators => $validators, }, $class);
74 10 100       54 return $self if ($self->is_valid());
75 1         3 $number =~ s/^(?:1)//;
76 1         10 $self = bless({ country_code => '692', number => $number, formatters => $formatters, validators => $validators, }, $class);
77 1 50       3 return $self->is_valid() ? $self : undef;
78             }
79             1;