File Coverage

blib/lib/Number/Phone/StubCountry/BZ.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::BZ;
20 2     2   1178 use base qw(Number::Phone::StubCountry);
  2         4  
  2         275  
21              
22 2     2   16 use strict;
  2         10  
  2         51  
23 2     2   13 use warnings;
  2         12  
  2         53  
24 2     2   15 use utf8;
  2         6  
  2         18  
25             our $VERSION = 1.20230614174401;
26              
27             my $formatters = [
28             {
29             'format' => '$1-$2',
30             'leading_digits' => '[2-8]',
31             'pattern' => '(\\d{3})(\\d{4})'
32             },
33             {
34             'format' => '$1-$2-$3-$4',
35             'pattern' => '(\\d)(\\d{3})(\\d{4})(\\d{3})'
36             }
37             ];
38              
39             my $validators = {
40             'fixed_line' => '
41             (?:
42             2(?:
43             [02]\\d|
44             36|
45             [68]0
46             )|
47             [3-58](?:
48             [02]\\d|
49             [68]0
50             )|
51             7(?:
52             [02]\\d|
53             32|
54             [68]0
55             )
56             )\\d{4}
57             ',
58             'geographic' => '
59             (?:
60             2(?:
61             [02]\\d|
62             36|
63             [68]0
64             )|
65             [3-58](?:
66             [02]\\d|
67             [68]0
68             )|
69             7(?:
70             [02]\\d|
71             32|
72             [68]0
73             )
74             )\\d{4}
75             ',
76             'mobile' => '6[0-35-7]\\d{5}',
77             'pager' => '',
78             'personal_number' => '',
79             'specialrate' => '',
80             'toll_free' => '0800\\d{7}',
81             'voip' => ''
82             };
83             my %areanames = ();
84             $areanames{en} = {"5014", "Corozal\ District",
85             "5017", "Toledo\ District",
86             "5015", "Stann\ Creek\ District",
87             "5018", "Cayo\ District",
88             "5013", "Orange\ Walk\ District",
89             "5012", "Belize\ District",};
90              
91             sub new {
92 10     10 1 21 my $class = shift;
93 10         30 my $number = shift;
94 10         64 $number =~ s/(^\+501|\D)//g;
95 10         60 my $self = bless({ country_code => '501', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
96 10 100       51 return $self->is_valid() ? $self : undef;
97             }
98             1;