File Coverage

blib/lib/Number/Phone/StubCountry/YT.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::YT;
20 3     3   1575 use base qw(Number::Phone::StubCountry);
  3         15  
  3         344  
21              
22 3     3   26 use strict;
  3         8  
  3         71  
23 3     3   17 use warnings;
  3         8  
  3         105  
24 3     3   23 use utf8;
  3         8  
  3         17  
25             our $VERSION = 1.20230903131449;
26              
27             my $formatters = [];
28              
29             my $validators = {
30             'fixed_line' => '
31             269(?:
32             0[0-467]|
33             5[0-4]|
34             6\\d|
35             [78]0
36             )\\d{4}
37             ',
38             'geographic' => '
39             269(?:
40             0[0-467]|
41             5[0-4]|
42             6\\d|
43             [78]0
44             )\\d{4}
45             ',
46             'mobile' => '
47             639(?:
48             0[0-79]|
49             1[019]|
50             [267]\\d|
51             3[09]|
52             40|
53             5[05-9]|
54             9[04-79]
55             )\\d{4}
56             ',
57             'pager' => '',
58             'personal_number' => '',
59             'specialrate' => '',
60             'toll_free' => '80\\d{7}',
61             'voip' => '
62             9(?:
63             (?:
64             39|
65             47
66             )8[01]|
67             769\\d
68             )\\d{4}
69             '
70             };
71              
72             sub new {
73 18     18 1 45 my $class = shift;
74 18         30 my $number = shift;
75 18         119 $number =~ s/(^\+262|\D)//g;
76 18         94 my $self = bless({ country_code => '262', number => $number, formatters => $formatters, validators => $validators, }, $class);
77 18 100       83 return $self if ($self->is_valid());
78 4         19 $number =~ s/^(?:0)//;
79 4         47 $self = bless({ country_code => '262', number => $number, formatters => $formatters, validators => $validators, }, $class);
80 4 50       17 return $self->is_valid() ? $self : undef;
81             }
82             1;