File Coverage

blib/lib/Number/Phone/StubCountry/WS.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::WS;
20 2     2   1149 use base qw(Number::Phone::StubCountry);
  2         6  
  2         254  
21              
22 2     2   27 use strict;
  2         7  
  2         49  
23 2     2   19 use warnings;
  2         5  
  2         46  
24 2     2   10 use utf8;
  2         5  
  2         13  
25             our $VERSION = 1.20230614174405;
26              
27             my $formatters = [
28             {
29             'format' => '$1',
30             'leading_digits' => '
31             [2-5]|
32             6[1-9]
33             ',
34             'pattern' => '(\\d{5})'
35             },
36             {
37             'format' => '$1 $2',
38             'leading_digits' => '[68]',
39             'pattern' => '(\\d{3})(\\d{3,7})'
40             },
41             {
42             'format' => '$1 $2',
43             'leading_digits' => '7',
44             'pattern' => '(\\d{2})(\\d{5})'
45             }
46             ];
47              
48             my $validators = {
49             'fixed_line' => '
50             6[1-9]\\d{3}|
51             (?:
52             [2-5]|
53             60
54             )\\d{4}
55             ',
56             'geographic' => '
57             6[1-9]\\d{3}|
58             (?:
59             [2-5]|
60             60
61             )\\d{4}
62             ',
63             'mobile' => '
64             (?:
65             7[1-35-7]|
66             8(?:
67             [3-7]|
68             9\\d{3}
69             )
70             )\\d{5}
71             ',
72             'pager' => '',
73             'personal_number' => '',
74             'specialrate' => '',
75             'toll_free' => '800\\d{3}',
76             'voip' => ''
77             };
78             my %areanames = ();
79             $areanames{en} = {"68567", "Apia",
80             "6853", "Apia",
81             "68569", "Apia",
82             "68568", "Apia",
83             "6855", "Savaii",
84             "6852", "Apia",
85             "68566", "Apia",
86             "68563", "Apia",
87             "68565", "Apia",
88             "68561", "Apia",
89             "68562", "Apia",
90             "68564", "Apia",
91             "6854", "Upolu\ Rural",};
92              
93             sub new {
94 10     10 1 28 my $class = shift;
95 10         17 my $number = shift;
96 10         60 $number =~ s/(^\+685|\D)//g;
97 10         61 my $self = bless({ country_code => '685', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
98 10 100       54 return $self->is_valid() ? $self : undef;
99             }
100             1;