Number::Phone::PT - Validate Portuguese phone numbers
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);
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.
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 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):
area_of
Mobile numbers always start with the digit 9. The first two digits identify the operator it belongs to. Here is the list:
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.
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.
Jose Alves de Castro, <cog [at] cpan [dot] org<gt>
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.
To install Number::Phone::PT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Number::Phone::PT
CPAN shell
perl -MCPAN -e shell install Number::Phone::PT
For more information on module installation, please visit the detailed CPAN module installation guide.