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   1154 use base qw(Number::Phone::StubCountry);
  2         5  
  2         233  
21              
22 2     2   16 use strict;
  2         5  
  2         44  
23 2     2   13 use warnings;
  2         8  
  2         53  
24 2     2   15 use utf8;
  2         4  
  2         11  
25             our $VERSION = 1.20230614174403;
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             [0239]\\d|
49             [16][0-3]|
50             4[03-9]|
51             5[6-9]|
52             80
53             )\\d{4}
54             ',
55             'geographic' => '
56             594(?:
57             [0239]\\d|
58             [16][0-3]|
59             4[03-9]|
60             5[6-9]|
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-2]
81             )\\d{4}
82             '
83             };
84              
85             sub new {
86 13     13 1 27 my $class = shift;
87 13         23 my $number = shift;
88 13         86 $number =~ s/(^\+594|\D)//g;
89 13         90 my $self = bless({ country_code => '594', number => $number, formatters => $formatters, validators => $validators, }, $class);
90 13 100       72 return $self if ($self->is_valid());
91 1         3 $number =~ s/^(?:0)//;
92 1         11 $self = bless({ country_code => '594', number => $number, formatters => $formatters, validators => $validators, }, $class);
93 1 50       5 return $self->is_valid() ? $self : undef;
94             }
95             1;