File Coverage

blib/lib/Number/Phone/StubCountry/BL.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::BL;
20 3     3   1544 use base qw(Number::Phone::StubCountry);
  3         11  
  3         382  
21              
22 3     3   28 use strict;
  3         12  
  3         72  
23 3     3   24 use warnings;
  3         29  
  3         94  
24 3     3   18 use utf8;
  3         10  
  3         19  
25             our $VERSION = 1.20230903131443;
26              
27             my $formatters = [];
28              
29             my $validators = {
30             'fixed_line' => '
31             590(?:
32             2[7-9]|
33             3[3-7]|
34             5[12]|
35             87
36             )\\d{4}
37             ',
38             'geographic' => '
39             590(?:
40             2[7-9]|
41             3[3-7]|
42             5[12]|
43             87
44             )\\d{4}
45             ',
46             'mobile' => '
47             69(?:
48             0\\d\\d|
49             1(?:
50             2[2-9]|
51             3[0-5]
52             )
53             )\\d{4}
54             ',
55             'pager' => '',
56             'personal_number' => '',
57             'specialrate' => '',
58             'toll_free' => '80[0-5]\\d{6}',
59             'voip' => '
60             9(?:
61             (?:
62             395|
63             76[018]
64             )\\d|
65             475[0-5]
66             )\\d{4}
67             '
68             };
69              
70             sub new {
71 18     18 1 41 my $class = shift;
72 18         33 my $number = shift;
73 18         116 $number =~ s/(^\+590|\D)//g;
74 18         95 my $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
75 18 100       88 return $self if ($self->is_valid());
76 2         6 $number =~ s/^(?:0)//;
77 2         23 $self = bless({ country_code => '590', number => $number, formatters => $formatters, validators => $validators, }, $class);
78 2 50       12 return $self->is_valid() ? $self : undef;
79             }
80             1;