|
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;
|