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   1200 use base qw(Number::Phone::StubCountry);
  2         10  
  2         228  
21              
22 2     2   31 use strict;
  2         6  
  2         47  
23 2     2   16 use warnings;
  2         17  
  2         50  
24 2     2   14 use utf8;
  2         6  
  2         13  
25             our $VERSION = 1.20230903131448;
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             "689404", "Îles\ du\ Vent\(IDV\)",
71             "689494", "Polynesia",
72             "689496", "Polynesia",
73             "689498", "Polynesia",
74             "689495", "Polynesia",
75             "689409", "Remote\ Archipelago",
76             "6894088", "Polynesia",
77             "689408", "Îles\ du\ Vent\(IDV\)",
78             "689405", "Îles\ du\ Vent\(IDV\)",};
79              
80             sub new {
81 16     16 1 32 my $class = shift;
82 16         27 my $number = shift;
83 16         101 $number =~ s/(^\+689|\D)//g;
84 16         105 my $self = bless({ country_code => '689', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
85 16 100       87 return $self->is_valid() ? $self : undef;
86             }
87             1;