NAME
Number::Phone::PT - Validate Portuguese phone numbers
SYNOPSIS
use Number::Phone::PT;
$number = 258374162;
print "$number is valid" if is_valid($number);
print "$number belongs to a home" if is_residential($number);
print "$number is a celular phone" if is_mobile($number);
print "$number belongs to someone" if is_personal($number);
# same thing as ( is_residential($number) or is_mobile($number) )
print "$number is from " . area_of($number) if is_residential($number);
DESCRIPTION
Validates Portuguese phone numbers. Does not check whether they exist or not; it just validates to see if they are well written.
Special numbers (as the emergency number 112, for instance), are currently not comtemplated.
PORTUGUESE PHONE NUMBERS
There are three kinds of telephone numbers in Portugal (currently): residential, mobile and service numbers.
All of these numbers are composed of nine digits.
RESIDENTIAL NUMBERS
Residential numbers always start with the digit 2. The first few digits identify the region it belongs to. Here is the list (note that the function area_of
may return accentuated words):
- 21 lisboa
- 22 porto
- 231 mealhada
- 232 viseu
- 233 figueira da foz
- 234 aveiro
- 235 arganil
- 236 pombal
- 238 seia
- 239 coimbra
- 241 abrantes
- 242 ponte de sor
- 243 santarem
- 244 leiria
- 245 portalegre
- 249 torres novas
- 251 valenca
- 252 vila nova de famalicao
- 253 braga
- 254 peso da regua
- 255 penafiel
- 256 sao joao da madeira
- 258 viana do castelo
- 259 vila real
- 261 torres vedras
- 263 caldas da rainha
- 265 setubal
- 266 evora
- 268 estremoz
- 269 santiago do cacem
- 271 guarda
- 272 castelo branco
- 273 braganca
- 274 proenca-a-nova
- 275 covilha
- 276 chaves
- 277 idanha-a-nova
- 278 mirandela
- 279 moncorvo
- 281 tavira
- 282 portimao
- 283 odemira
- 284 beja
- 285 moura
- 286 castro verde
- 289 faro
- 291 funchal, porto santo
- 292 corvo, faial, flores, horta, pico
- 295 angra do heroismo, graciosa, sao jorge, terceira
- 296 ponta delgada, sao miguel, santa maria
MOBILE NUMBERS
Mobile numbers always start with the digit 9. The first two digits identify the operator it belongs to. Here is the list:
SERVICE NUMBERS
Service numbers start with 707, 760, 800 or 808 (currently). Please refer to Portugal Telecom in order to know how they work, as they change from time to time.
MESSAGE FROM THE AUTHOR
If you're using this module, please drop me a line to my e-mail. Tell me what you're doing with it. Also, feel free to suggest new bugs^H^H^H^H^H features.
AUTHOR
Jose Alves de Castro, <cog [at] cpan [dot] org<gt>
COPYRIGHT AND LICENSE
Copyright 2004 by Jose Alves de Castro
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.