File Coverage

blib/lib/Number/Phone/StubCountry/PF.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::PF;
20 2     2   1158 use base qw(Number::Phone::StubCountry);
  2         7  
  2         206  
21              
22 2     2   13 use strict;
  2         5  
  2         43  
23 2     2   10 use warnings;
  2         6  
  2         42  
24 2     2   10 use utf8;
  2         6  
  2         11  
25             our $VERSION = 1.20230307181421;
26              
27             my $formatters = [
28             {
29             'format' => '$1 $2 $3',
30             'leading_digits' => '44',
31             'pattern' => '(\\d{2})(\\d{2})(\\d{2})'
32             },
33             {
34             'format' => '$1 $2 $3 $4',
35             'leading_digits' => '
36             4|
37             8[7-9]
38             ',
39             'pattern' => '(\\d{2})(\\d{2})(\\d{2})(\\d{2})'
40             },
41             {
42             'format' => '$1 $2 $3 $4',
43             'leading_digits' => '8',
44             'pattern' => '(\\d{3})(\\d{2})(\\d{2})(\\d{2})'
45             }
46             ];
47              
48             my $validators = {
49             'fixed_line' => '
50             4(?:
51             0[4-689]|
52             9[4-68]
53             )\\d{5}
54             ',
55             'geographic' => '
56             4(?:
57             0[4-689]|
58             9[4-68]
59             )\\d{5}
60             ',
61             'mobile' => '8[7-9]\\d{6}',
62             'pager' => '',
63             'personal_number' => '',
64             'specialrate' => '(44\\d{4})',
65             'toll_free' => '80[0-5]\\d{6}',
66             'voip' => '499\\d{5}'
67             };
68             my %areanames = ();
69             $areanames{en} = {"689406", "Îles\ Sous\-le\-vent\(ISLV\)",
70             "689498", "Polynesia",
71             "689409", "Remote\ Archipelago",
72             "689404", "Îles\ du\ Vent\(IDV\)",
73             "689405", "Îles\ du\ Vent\(IDV\)",
74             "689496", "Polynesia",
75             "6894088", "Polynesia",
76             "689408", "Îles\ du\ Vent\(IDV\)",
77             "689494", "Polynesia",
78             "689495", "Polynesia",};
79              
80             sub new {
81 16     16 1 37 my $class = shift;
82 16         38 my $number = shift;
83 16         109 $number =~ s/(^\+689|\D)//g;
84 16         95 my $self = bless({ country_code => '689', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
85 16 100       80 return $self->is_valid() ? $self : undef;
86             }
87             1;