File Coverage

blib/lib/Number/Phone/StubCountry/GL.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::GL;
20 2     2   1282 use base qw(Number::Phone::StubCountry);
  2         11  
  2         211  
21              
22 2     2   15 use strict;
  2         6  
  2         47  
23 2     2   12 use warnings;
  2         8  
  2         61  
24 2     2   13 use utf8;
  2         5  
  2         11  
25             our $VERSION = 1.20230307181420;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '
31             19|
32             [2-9]
33             ',
34             'pattern' => '(\\d{2})(\\d{2})(\\d{2})'
35             }
36             ];
37              
38             my $validators = {
39             'fixed_line' => '
40             (?:
41             19|
42             3[1-7]|
43             6[14689]|
44             70|
45             8[14-79]|
46             9\\d
47             )\\d{4}
48             ',
49             'geographic' => '
50             (?:
51             19|
52             3[1-7]|
53             6[14689]|
54             70|
55             8[14-79]|
56             9\\d
57             )\\d{4}
58             ',
59             'mobile' => '[245]\\d{5}',
60             'pager' => '',
61             'personal_number' => '',
62             'specialrate' => '',
63             'toll_free' => '80\\d{4}',
64             'voip' => '3[89]\\d{4}'
65             };
66             my %areanames = ();
67             $areanames{en} = {"29968", "Paamiut",
68             "29997", "Qaanaaq",
69             "29961", "Nanortalik",
70             "29987", "Kangaatsiaq",
71             "29936", "Nuuk",
72             "29933", "Nuuk",
73             "29991", "Qasigannguit",
74             "29992", "Qeqertasuaq",
75             "29995", "Uummannaq",
76             "29998", "Tasiilaq",
77             "29985", "Sisimiut",
78             "299691", "Ivittuut",
79             "29981", "Maniitsoq",
80             "29934", "Nuuk",
81             "29996", "Upernavik",
82             "29964", "Qaqortoq",
83             "29986", "Sisimiut",
84             "29994", "Ilulissat",
85             "29999", "Ittoqqortoormiit",
86             "29984", "Kangerlussuaq",
87             "29935", "Nuuk",
88             "29989", "Aasiaat",
89             "29966", "Narsaq",
90             "29932", "Nuuk",
91             "29931", "Nuuk",};
92              
93             sub new {
94 13     13 1 37 my $class = shift;
95 13         23 my $number = shift;
96 13         79 $number =~ s/(^\+299|\D)//g;
97 13         72 my $self = bless({ country_code => '299', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
98 13 100       61 return $self->is_valid() ? $self : undef;
99             }
100             1;