File Coverage

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