File Coverage

blib/lib/Number/Phone/StubCountry/GF.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::GF;
20 2     2   1179 use base qw(Number::Phone::StubCountry);
  2         9  
  2         232  
21              
22 2     2   16 use strict;
  2         9  
  2         48  
23 2     2   11 use warnings;
  2         9  
  2         55  
24 2     2   14 use utf8;
  2         4  
  2         12  
25             our $VERSION = 1.20230903131447;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3 $4',
30             'leading_digits' => '
31             [56]|
32             9[47]
33             ',
34             'national_rule' => '0$1',
35             'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})'
36             },
37             {
38             'format' => '$1 $2 $3 $4',
39             'leading_digits' => '[89]',
40             'national_rule' => '0$1',
41             'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})'
42             }
43             ];
44              
45             my $validators = {
46             'fixed_line' => '
47             594(?:
48             [02-49]\\d|
49             1[0-4]|
50             5[6-9]|
51             6[0-3]|
52             80
53             )\\d{4}
54             ',
55             'geographic' => '
56             594(?:
57             [02-49]\\d|
58             1[0-4]|
59             5[6-9]|
60             6[0-3]|
61             80
62             )\\d{4}
63             ',
64             'mobile' => '
65             694(?:
66             [0-249]\\d|
67             3[0-8]
68             )\\d{4}
69             ',
70             'pager' => '',
71             'personal_number' => '',
72             'specialrate' => '',
73             'toll_free' => '80[0-5]\\d{6}',
74             'voip' => '
75             9(?:
76             (?:
77             396|
78             76\\d
79             )\\d|
80             476[0-5]
81             )\\d{4}
82             '
83             };
84              
85             sub new {
86 13     13 1 30 my $class = shift;
87 13         30 my $number = shift;
88 13         84 $number =~ s/(^\+594|\D)//g;
89 13         70 my $self = bless({ country_code => '594', number => $number, formatters => $formatters, validators => $validators, }, $class);
90 13 100       67 return $self if ($self->is_valid());
91 1         4 $number =~ s/^(?:0)//;
92 1         12 $self = bless({ country_code => '594', number => $number, formatters => $formatters, validators => $validators, }, $class);
93 1 50       10 return $self->is_valid() ? $self : undef;
94             }
95             1;