Number::Phone::PT - Validate Portuguese phone numbers


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):

  1. lisboa
  2. porto
  3. mealhada
  4. viseu
  5. figueira da foz
  6. aveiro
  7. arganil
  8. pombal
  9. seia
  10. coimbra
  11. abrantes
  12. ponte de sor
  13. santarem
  14. leiria
  15. portalegre
  16. torres novas
  17. valenca
  18. vila nova de famalicao
  19. braga
  20. peso da regua
  21. penafiel
  22. sao joao da madeira
  23. viana do castelo
  24. vila real
  25. torres vedras
  26. caldas da rainha
  27. setubal
  28. evora
  29. estremoz
  30. santiago do cacem
  31. guarda
  32. castelo branco
  33. braganca
  34. proenca-a-nova
  35. covilha
  36. chaves
  37. idanha-a-nova
  38. mirandela
  39. moncorvo
  40. tavira
  41. portimao
  42. odemira
  43. beja
  44. moura
  45. castro verde
  46. faro
  47. funchal, porto santo
  48. corvo, faial, flores, horta, pico
  49. angra do heroismo, graciosa, sao jorge, terceira
  50. 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:

  1. Vodafone / Yorn
  2. Optimus
  3. TMN

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.

  1. numero unico
  2. numero unico
  3. numero gratis
  4. chamada local


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.

 Number::Phone::PT - Validate Portuguese phone numbers