Sponsoring The Perl Toolchain Summit 2025: Help make this important event another success Learn more

# automatically generated file, don't edit
# Copyright 2024 David Cantrell, derived from data from libphonenumber
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
use strict;
use utf8;
our $VERSION = 1.20250323211839;
my $formatters = [];
my $validators = {
'fixed_line' => '
269(?:
0[0-467]|
15|
5[0-4]|
6\\d|
[78]0
)\\d{4}
',
'geographic' => '
269(?:
0[0-467]|
15|
5[0-4]|
6\\d|
[78]0
)\\d{4}
',
'mobile' => '
(?:
639(?:
0[0-79]|
1[019]|
[267]\\d|
3[09]|
40|
5[05-9]|
9[04-79]
)|
7093[5-7]
)\\d{4}
',
'pager' => '',
'personal_number' => '',
'specialrate' => '',
'toll_free' => '80\\d{7}',
'voip' => '
9(?:
(?:
39|
47
)8[01]|
769\\d
)\\d{4}
'
};
my $timezones = {
'' => [
'Indian/Mayotte',
'Indian/Reunion'
],
'262' => [
'Indian/Reunion'
],
'263' => [
'Indian/Reunion'
],
'269' => [
'Indian/Mayotte'
],
'63' => [
'Indian/Mayotte'
],
'69' => [
'Indian/Reunion'
],
'7092' => [
'Indian/Reunion'
],
'7093' => [
'Indian/Mayotte'
],
'80' => [
'Indian/Mayotte',
'Indian/Reunion'
],
'81' => [
'Indian/Reunion'
],
'82' => [
'Indian/Reunion'
],
'88' => [
'Indian/Reunion'
],
'89' => [
'Indian/Reunion'
],
'9398' => [
'Indian/Mayotte'
],
'9399' => [
'Indian/Reunion'
],
'9478' => [
'Indian/Mayotte'
],
'9479' => [
'Indian/Reunion'
],
'9762' => [
'Indian/Reunion'
],
'9763' => [
'Indian/Reunion'
],
'9769' => [
'Indian/Mayotte'
]
};
sub new {
my $class = shift;
my $number = shift;
$number =~ s/(^\+262|\D)//g;
my $self = bless({ country_code => '262', number => $number, formatters => $formatters, validators => $validators, timezones => $timezones, }, $class);
return $self if ($self->is_valid());
$number =~ s/^(?:0)//;
$self = bless({ country_code => '262', number => $number, formatters => $formatters, validators => $validators, }, $class);
return $self->is_valid() ? $self : undef;
}
1;