The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Number::Phone::Country - Lookup country of phone number

SYNOPSIS

  use Number::Phone::Country;

  #returns 'CA' for Canada
  my $iso_country_code = phone2country("1 (604) 111-1111");

or

  use Number::Phone::Country qw(noexport uk);

  my $iso_country_code = Number::Phone::Country::phone2country(...);

or

  my ($iso_country_code, $idd) = Number::Phone::Country::phone2country_and_idd(...);

DESCRIPTION

This module lookups up the country based on a telephone number. It uses the International Direct Dialing (IDD) prefix, and lookups North American numbers using the Area Code, in accordance with the North America Numbering Plan (NANP).

Note that by default, phone2country is exported into your namespace. This is deprecated and may be removed in a future version. You can turn that off by passing the 'noexport' constant when you use the module.

Also be aware that the ISO code for the United Kingdom is GB, not UK. If you would prefer UK, pass the 'uk' constant.

SEE ALSO

Parse::PhoneNumber

BUGS

It has not been possible to maintain complete backwards compatibility with the original 0.01 release. To fix a bug, while still retaining the ability to look up plain un-adorned NANP numbers without the +1 prefix, all non-NANP numbers *must* have their leading + sign.

Another incompatibility - it was previously assumed that any number not assigned to some other country was in the US. This was incorrect for (eg) 800 numbers. These are now identified as being generic NANP numbers.

Will go out of date every time the NANP has one of its code splits/overlays. So that's about once a month then. I'll do my best to keep it up to date.

WARNING

Be aware that the ISO 3166 country code for Yugoslavia has changed. It used to be YU, and is now CS.

The pesky Yugoslavs keep changing their minds. They've changed again to RS and ME, with exciting new IDD code changes to go with it. Yay.

AUTHOR

now maintained by David Cantrell <david@cantrell.org.uk>

originally by TJ Mather, <tjmather@maxmind.com>

Thanks to Shraga Bor-Sood for the updates in version 1.4.

COPYRIGHT AND LICENSE

Copyright 2003 by MaxMind LLC

Copyright 2004, 2005, 2006 David Cantrell

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.