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   1283 use base qw(Number::Phone::StubCountry);
  2         7  
  2         257  
21              
22 2     2   18 use strict;
  2         7  
  2         56  
23 2     2   16 use warnings;
  2         9  
  2         54  
24 2     2   14 use utf8;
  2         6  
  2         13  
25             our $VERSION = 1.20230903131448;
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} = {"58294", "Sucre",
75             "58279", "Falcón",
76             "58264", "Zulia",
77             "58238", "Guárico",
78             "58259", "Falcón",
79             "58234", "Miranda",
80             "58293", "Sucre",
81             "58289", "Bolívar",
82             "58263", "Zulia",
83             "58245", "Carabobo",
84             "58268", "Falcón",
85             "58273", "Barinas",
86             "58242", "Carabobo",
87             "58284", "Bolívar",
88             "58241", "Carabobo",
89             "58239", "Miranda",
90             "58258", "Cojedes",
91             "58246", "Aragua\/Guárico",
92             "58278", "Apure\/Barinas",
93             "58253", "Lara\/Yaracuy",
94             "58283", "Anzoátegui",
95             "58269", "Falcón",
96             "58274", "Mérida",
97             "58288", "Bolívar",
98             "58247", "Apure\/Barinas\/Guárico",
99             "58254", "Yaracuy",
100             "58240", "Apure\/Barinas",
101             "58249", "Carabobo",
102             "58267", "Zulia",
103             "58285", "Anzoátegui\/Bolívar",
104             "58261", "Zulia",
105             "58292", "Anzoátegui\/Monagas",
106             "58255", "Portuguesa",
107             "58262", "Zulia",
108             "58291", "Monagas",
109             "58275", "Táchira\/Mérida\/Zulia",
110             "58296", "Amazonas",
111             "58266", "Zulia",
112             "58237", "Federal\ Dependencies",
113             "58272", "Trujillo",
114             "58243", "Aragua\/Carabobo",
115             "58256", "Portuguesa",
116             "58271", "Mérida\/Trujillo\/Zulia",
117             "58251", "Lara\/Yaracuy",
118             "58276", "Táchira",
119             "58248", "Amazonas",
120             "58295", "Nueva\ Esparta",
121             "58252", "Lara",
122             "58287", "Delta\ Amacuro\/Monagas",
123             "58265", "Zulia",
124             "58257", "Portuguesa",
125             "58282", "Anzoátegui",
126             "58244", "Aragua",
127             "58281", "Anzoátegui",
128             "58286", "Anzoátegui\/Bolívar",
129             "58235", "Anzoátegui\/Bolívar\/Guárico",
130             "58277", "Táchira\/Mérida",
131             "5821", "Caracas\/Miranda\/Vargas",};
132             $areanames{es} = {"5821", "Distrito\ Capital\/Miranda\/Vargas",
133             "58277", "Mérida\/Táchira",
134             "58237", "Dependencias\ Federales",
135             "58275", "Mérida\/Táchira\/Zulia",};
136              
137             sub new {
138 16     16 1 35 my $class = shift;
139 16         35 my $number = shift;
140 16         106 $number =~ s/(^\+58|\D)//g;
141 16         95 my $self = bless({ country_code => '58', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
142 16 100       80 return $self if ($self->is_valid());
143 1         3 $number =~ s/^(?:0)//;
144 1         16 $self = bless({ country_code => '58', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
145 1 50       4 return $self->is_valid() ? $self : undef;
146             }
147             1;