File Coverage

blib/lib/Number/Phone/StubCountry/LY.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::LY;
20 2     2   1190 use base qw(Number::Phone::StubCountry);
  2         5  
  2         259  
21              
22 2     2   18 use strict;
  2         4  
  2         55  
23 2     2   12 use warnings;
  2         11  
  2         54  
24 2     2   11 use utf8;
  2         10  
  2         12  
25             our $VERSION = 1.20230307181421;
26              
27             my $formatters = [
28             {
29             'format' => '$1-$2',
30             'leading_digits' => '[2-9]',
31             'national_rule' => '0$1',
32             'pattern' => '(\\d{2})(\\d{7})'
33             }
34             ];
35              
36             my $validators = {
37             'fixed_line' => '
38             (?:
39             2(?:
40             0[56]|
41             [1-6]\\d|
42             7[124579]|
43             8[124]
44             )|
45             3(?:
46             1\\d|
47             2[2356]
48             )|
49             4(?:
50             [17]\\d|
51             2[1-357]|
52             5[2-4]|
53             8[124]
54             )|
55             5(?:
56             [1347]\\d|
57             2[1-469]|
58             5[13-5]|
59             8[1-4]
60             )|
61             6(?:
62             [1-479]\\d|
63             5[2-57]|
64             8[1-5]
65             )|
66             7(?:
67             [13]\\d|
68             2[13-79]
69             )|
70             8(?:
71             [124]\\d|
72             5[124]|
73             84
74             )
75             )\\d{6}
76             ',
77             'geographic' => '
78             (?:
79             2(?:
80             0[56]|
81             [1-6]\\d|
82             7[124579]|
83             8[124]
84             )|
85             3(?:
86             1\\d|
87             2[2356]
88             )|
89             4(?:
90             [17]\\d|
91             2[1-357]|
92             5[2-4]|
93             8[124]
94             )|
95             5(?:
96             [1347]\\d|
97             2[1-469]|
98             5[13-5]|
99             8[1-4]
100             )|
101             6(?:
102             [1-479]\\d|
103             5[2-57]|
104             8[1-5]
105             )|
106             7(?:
107             [13]\\d|
108             2[13-79]
109             )|
110             8(?:
111             [124]\\d|
112             5[124]|
113             84
114             )
115             )\\d{6}
116             ',
117             'mobile' => '9[1-6]\\d{7}',
118             'pager' => '',
119             'personal_number' => '',
120             'specialrate' => '',
121             'toll_free' => '',
122             'voip' => ''
123             };
124             my %areanames = ();
125             $areanames{en} = {"218682", "Jardas",
126             "218821", "Gubba",
127             "218733", "Garda",
128             "218326", "Kussabat",
129             "21822", "Ben\ Gashir",
130             "218481", "Kabaw",
131             "218657", "Jalo",
132             "218652", "Kofra",
133             "218521", "Zliten",
134             "218206", "Suk\ Elkhamis",
135             "218623", "Gmines",
136             "218523", "Dafnia",
137             "218224", "Swajni",
138             "218852", "Massa",
139             "218422", "Mizda",
140             "218427", "Kikla",
141             "218731", "Wadi\ Atba",
142             "218453", "Reyana",
143             "218582", "Sokna",
144             "218279", "Elmaya",
145             "218584", "Zella",
146             "218854", "Slenta",
147             "21824", "Sabratha",
148             "21861", "Benghazi",
149             "218554", "Wadi\ Jeref",
150             "218729", "Ghrefa",
151             "21826", "Taigura",
152             "21881", "Derna",
153             "218654", "Sidi\ Sultan\ Sultan",
154             "218275", "Matred",
155             "218725", "Murzuk",
156             "21851", "Misratah",
157             "218281", "Jmail",
158             "21888", "Jaghbub",
159             "218684", "Elbayada",
160             "218625", "Deriana",
161             "218529", "Bugrain",
162             "218629", "Elmagrun",
163             "21871", "Sebha",
164             "218271", "Hashan",
165             "21857", "Hun",
166             "218721", "Brak",
167             "218723", "Edry",
168             "21867", "Elmareg",
169             "21823", "Zawia",
170             "218322", "Bani\ Walid",
171             "218274", "Abu\ Issa",
172             "218655", "Bisher",
173             "218724", "Ghat",
174             "218685", "Tomina",
175             "21831", "Khums",
176             "218425", "Buzayan",
177             "21863", "Benina",
178             "218555", "Noflia",
179             "21847", "Nalut",
180             "218526", "Zawyat\ Elmahjub",
181             "218626", "Kaalifa",
182             "218727", "Zawaya",
183             "218323", "Wadi\ Keam",
184             "218272", "Azizia",
185             "218277", "Mamura",
186             "218851", "Shahat",
187             "218421", "Yefren",
188             "21821", "Tripoli",
189             "218581", "Wodan",
190             "218683", "Taknes",
191             "21825", "Zuara",
192             "218732", "Bergen",
193             "218628", "Seluk",
194             "218627", "Jerdina",
195             "218653", "Ojla",
196             "218551", "Sirt",
197             "218726", "Um\ Laranib",
198             "218553", "Abuhadi",
199             "218482", "Tigi",
200             "218522", "Tawergha",
201             "21884", "El\ Beida",
202             "218681", "Tolmitha",
203             "21854", "Sirt",
204             "218452", "Rujban",
205             "218583", "Soussa",
206             "218284", "Hugialin",
207             "218423", "Guassem",
208             "218282", "Agelat\,\ Ajalat",
209             "218454", "Al\ Josh",
210             "218524", "Kasarahmad",
211             "218252", "Zahra",
212             "21873", "Ubary",
213             "218484", "Ghadames",
214             "218325", "Tarhuna",
215             "21882", "Haraua",
216             "218624", "Elkuwaifia",
217             "21841", "Garian",
218             "218205", "Sidiessaiah",
219             "218734", "Traghen",};
220              
221             sub new {
222 7     7 1 27 my $class = shift;
223 7         10 my $number = shift;
224 7         48 $number =~ s/(^\+218|\D)//g;
225 7         35 my $self = bless({ country_code => '218', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
226 7 100       36 return $self if ($self->is_valid());
227 1         2 $number =~ s/^(?:0)//;
228 1         12 $self = bless({ country_code => '218', number => $number, formatters => $formatters, validators => $validators, areanames => \%areanames}, $class);
229 1 50       5 return $self->is_valid() ? $self : undef;
230             }
231             1;