- INCOMPATIBILITIES WITH NUMBER::PHONE
- NOT IMPLEMENTED
- SEE ALSO
- COPYRIGHT AND LICENSE
Number::Phone::BR - Brazilian phone numbers
# valid phone my $phone = Number::Phone::BR->new('(19) 3333-3333'); say $phone->areaname; # SP - Região Metropolitana de Campinas say $phone->subscriber; # 33333333 say $phone->is_fixed_line ? "It's fixed!" : "It's mobile!"; # It's fixed # invalid phone: my $phone = Number::Phone::BR->new('xxx'); # throws exception: "Not a valid Brazilian phone number: xxx", with stack # trace.
This module is based on Number::Phone. It implements most important features defined there.
Number::Phone requires the subclass to return undef from the constructor when the number is not valid. We think this is poorly designed, and not compatible with most modern Perl libraries in CPAN today. Additionally, we're using Moo, and we'd have to make ugly hacks to make the constructor behave like that. The same would've happened if we were using Moose. Seems logical to break compatibility on this point, and throw an exception when the number is not valid.
The country of the phone: 'BR'.
The country code of the phone: 55.
The subscriber part of the phone number.
The area code of the phone number (DDD).
Gets the name of the region to which the areacode belongs.
Boolean. Is the phone a mobile phone?
Boolean. Is the phone a valid number?
Boolean. Is the phone a fixed line?
Number::Phone defines the following methods, which are not implemented in this class:
André Walker <email@example.com>
This software is copyright (c) 2014 by André Walker.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.