File Coverage

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