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