File Coverage

blib/lib/Number/Phone/StubCountry/VE.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::VE;
20 2     2   1353 use base qw(Number::Phone::StubCountry);
  2         8  
  2         292  
21              
22 2     2   21 use strict;
  2         11  
  2         48  
23 2     2   21 use warnings;
  2         8  
  2         56  
24 2     2   20 use utf8;
  2         7  
  2         16  
25             our $VERSION = 1.20230307181422;
26              
27             my $formatters = [
28             {
29             'format' => '$1-$2',
30             'leading_digits' => '[24-689]',
31             'national_rule' => '0$1',
32             'pattern' => '(\\d{3})(\\d{7})'
33             }
34             ];
35              
36             my $validators = {
37             'fixed_line' => '
38             (?:
39             2(?:
40             12|
41             3[457-9]|
42             [467]\\d|
43             [58][1-9]|
44             9[1-6]
45             )|
46             [4-6]00
47             )\\d{7}
48             ',
49             'geographic' => '
50             (?:
51             2(?:
52             12|
53             3[457-9]|
54             [467]\\d|
55             [58][1-9]|
56             9[1-6]
57             )|
58             [4-6]00
59             )\\d{7}
60             ',
61             'mobile' => '
62             4(?:
63             1[24-8]|
64             2[46]
65             )\\d{7}
66             ',
67             'pager' => '',
68             'personal_number' => '',
69             'specialrate' => '(90[01]\\d{7})|(501\\d{7})',
70             'toll_free' => '800\\d{7}',
71             'voip' => ''
72             };
73             my %areanames = ();
74             $areanames{en} = {"58283", "Anzoátegui",
75             "58246", "Aragua\/Guárico",
76             "58277", "Táchira\/Mérida",
77             "58296", "Amazonas",
78             "58253", "Lara\/Yaracuy",
79             "58244", "Aragua",
80             "58263", "Zulia",
81             "58249", "Carabobo",
82             "58235", "Anzoátegui\/Bolívar\/Guárico",
83             "58294", "Sucre",
84             "58238", "Guárico",
85             "58272", "Trujillo",
86             "58265", "Zulia",
87             "58247", "Apure\/Barinas\/Guárico",
88             "58261", "Zulia",
89             "58276", "Táchira",
90             "58268", "Falcón",
91             "58281", "Anzoátegui",
92             "58242", "Carabobo",
93             "58285", "Anzoátegui\/Bolívar",
94             "58258", "Cojedes",
95             "58288", "Bolívar",
96             "58279", "Falcón",
97             "58292", "Anzoátegui\/Monagas",
98             "58255", "Portuguesa",
99             "58274", "Mérida",
100             "58251", "Lara\/Yaracuy",
101             "58264", "Zulia",
102             "58243", "Aragua\/Carabobo",
103             "58269", "Falcón",
104             "58286", "Anzoátegui\/Bolívar",
105             "58237", "Federal\ Dependencies",
106             "58256", "Portuguesa",
107             "58293", "Sucre",
108             "58284", "Bolívar",
109             "58266", "Zulia",
110             "58278", "Apure\/Barinas",
111             "58289", "Bolívar",
112             "5821", "Caracas\/Miranda\/Vargas",
113             "58259", "Falcón",
114             "58275", "Táchira\/Mérida\/Zulia",
115             "58254", "Yaracuy",
116             "58271", "Mérida\/Trujillo\/Zulia",
117             "58262", "Zulia",
118             "58287", "Delta\ Amacuro\/Monagas",
119             "58240", "Apure\/Barinas",
120             "58257", "Portuguesa",
121             "58273", "Barinas",
122             "58245", "Carabobo",
123             "58267", "Zulia",
124             "58282", "Anzoátegui",
125             "58239", "Miranda",
126             "58241", "Carabobo",
127             "58234", "Miranda",
128             "58295", "Nueva\ Esparta",
129             "58291", "Monagas",
130             "58248", "Amazonas",
131             "58252", "Lara",};
132             $areanames{es} = {"58277", "Mérida\/Táchira",
133             "5821", "Distrito\ Capital\/Miranda\/Vargas",
134             "58275", "Mérida\/Táchira\/Zulia",
135             "58237", "Dependencias\ Federales",};
136              
137             sub new {
138 16     16 1 32 my $class = shift;
139 16         34 my $number = shift;
140 16         105 $number =~ s/(^\+58|\D)//g;
141 16         89 my $self = bless({ country_code => '58', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
142 16 100       71 return $self if ($self->is_valid());
143 1         2 $number =~ s/^(?:0)//;
144 1         11 $self = bless({ country_code => '58', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
145 1 50       8 return $self->is_valid() ? $self : undef;
146             }
147             1;