our
$VERSION
= 1.20250323211828;
my
$formatters
= [
{
'format'
=>
'$1 $2'
,
'leading_digits'
=>
'[2-8]'
,
'pattern'
=>
'(\\d{4})(\\d{4})'
},
{
'format'
=>
'$1 $2 $3'
,
'leading_digits'
=>
'1'
,
'pattern'
=>
'(\\d{4})(\\d{3})(\\d{4})'
}
];
my
$validators
= {
'fixed_line'
=>
'[267][2-9]\\d{6}'
,
'geographic'
=>
'[267][2-9]\\d{6}'
,
'mobile'
=> '
(?:
[3-5]\\d\\d|
80[0-4]
)\\d{5}
',
'pager'
=>
''
,
'personal_number'
=>
''
,
'specialrate'
=>
'(19\\d{9})'
,
'toll_free'
=>
'18[01]\\d{8}'
,
'voip'
=>
''
};
my
$timezones
= {
''
=> [
'America/Guatemala'
]
};
sub
new {
my
$class
=
shift
;
my
$number
=
shift
;
$number
=~ s/(^\+502|\D)//g;
my
$self
=
bless
({
country_code
=>
'502'
,
number
=>
$number
,
formatters
=>
$formatters
,
validators
=>
$validators
,
timezones
=>
$timezones
, },
$class
);
return
$self
->is_valid() ?
$self
:
undef
;
}
1;