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::TZ; |
20
|
2
|
|
|
2
|
|
1310
|
use base qw(Number::Phone::StubCountry); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
260
|
|
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
18
|
use strict; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
55
|
|
23
|
2
|
|
|
2
|
|
19
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
60
|
|
24
|
2
|
|
|
2
|
|
13
|
use utf8; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
28
|
|
25
|
|
|
|
|
|
|
our $VERSION = 1.20230614174404; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $formatters = [ |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
30
|
|
|
|
|
|
|
'leading_digits' => '[89]', |
31
|
|
|
|
|
|
|
'national_rule' => '0$1', |
32
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{2})(\\d{4})' |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
36
|
|
|
|
|
|
|
'leading_digits' => '[24]', |
37
|
|
|
|
|
|
|
'national_rule' => '0$1', |
38
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{3})(\\d{4})' |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
'format' => '$1 $2', |
42
|
|
|
|
|
|
|
'leading_digits' => '5', |
43
|
|
|
|
|
|
|
'pattern' => '(\\d{2})(\\d{7})' |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
'format' => '$1 $2 $3', |
47
|
|
|
|
|
|
|
'leading_digits' => '[67]', |
48
|
|
|
|
|
|
|
'national_rule' => '0$1', |
49
|
|
|
|
|
|
|
'pattern' => '(\\d{3})(\\d{3})(\\d{3})' |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
]; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $validators = { |
54
|
|
|
|
|
|
|
'fixed_line' => '2[2-8]\\d{7}', |
55
|
|
|
|
|
|
|
'geographic' => '2[2-8]\\d{7}', |
56
|
|
|
|
|
|
|
'mobile' => ' |
57
|
|
|
|
|
|
|
77[2-9]\\d{6}| |
58
|
|
|
|
|
|
|
(?: |
59
|
|
|
|
|
|
|
6[125-9]| |
60
|
|
|
|
|
|
|
7[13-689] |
61
|
|
|
|
|
|
|
)\\d{7} |
62
|
|
|
|
|
|
|
', |
63
|
|
|
|
|
|
|
'pager' => '', |
64
|
|
|
|
|
|
|
'personal_number' => '', |
65
|
|
|
|
|
|
|
'specialrate' => '( |
66
|
|
|
|
|
|
|
8(?: |
67
|
|
|
|
|
|
|
40| |
68
|
|
|
|
|
|
|
6[01] |
69
|
|
|
|
|
|
|
)\\d{6} |
70
|
|
|
|
|
|
|
)|(90\\d{7})', |
71
|
|
|
|
|
|
|
'toll_free' => '80[08]\\d{6}', |
72
|
|
|
|
|
|
|
'voip' => '41\\d{7}' |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
my %areanames = (); |
75
|
|
|
|
|
|
|
$areanames{en} = {"25526", "Dodoma\/Iringa\/Njombe\/Singida\/Tabora", |
76
|
|
|
|
|
|
|
"25525", "Mbeya\/Songwe\/Ruvuma\/Katavi\/Rukwa", |
77
|
|
|
|
|
|
|
"25527", "Arusha\/Manyara\/Kilimanjaro\/Tanga", |
78
|
|
|
|
|
|
|
"25523", "Coast\/Morogoro\/Lindi\/Mtwara", |
79
|
|
|
|
|
|
|
"25524", "Zanzibar", |
80
|
|
|
|
|
|
|
"25528", "Mwanza\/Shinyanga\/Mara\/Geita\/Simiyu\/Kagera\/Kigoma", |
81
|
|
|
|
|
|
|
"25522", "Dar\-Es\-Salaam",}; |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub new { |
84
|
19
|
|
|
19
|
1
|
46
|
my $class = shift; |
85
|
19
|
|
|
|
|
33
|
my $number = shift; |
86
|
19
|
|
|
|
|
125
|
$number =~ s/(^\+255|\D)//g; |
87
|
19
|
|
|
|
|
122
|
my $self = bless({ country_code => '255', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
88
|
19
|
100
|
|
|
|
98
|
return $self if ($self->is_valid()); |
89
|
1
|
|
|
|
|
3
|
$number =~ s/^(?:0)//; |
90
|
1
|
|
|
|
|
10
|
$self = bless({ country_code => '255', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class); |
91
|
1
|
50
|
|
|
|
4
|
return $self->is_valid() ? $self : undef; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
1; |