Michael Schout

NAME

Number::Phone::CountryCode - Country phone dialing prefixes

SYNOPSIS

 use Number::Phone::CountryCode;

 # retrieve object of United Kingdom codes.
 my $pc = Number::Phone::CountryCode->new('GB');

 print $pc->country;       # ISO 3166 code, e.g: GB
 print $pc->country_code;  # country prefix
 print $pc->idd_prefix;    # IDD prefix
 print $pc->ndd_prefix;    # NDD prefix

 # get list of supported ISO 3166 codes
 my @countries = Number::Phone::CountryCode->countries;

See below for description of the country/IDD/NDD prefixes.

DESCRIPTION

This module provides an interface to lookup country specific dialing prefixes. These prefixes are useful when working with phone numbers from different countries. The follwing codes are available for each country:

Country Code

This is the national prefix to be used with dialing to a country from another country.

National Direct Dialing Prefix (NDD)

This is the prefix used to make a call within a country from one city to another. This prefix may not be necessary when calling another city in the same vicinity. This is followed by the city or area code for the place you are calling. For example, in the US, the NDD prefix is "1", so you must dial 1 before the area code to place a long distance call within the country.

International Direct Dialing Prefix (IDD)

This is the prefix needed to make a call from a country to another country. This is followed by the country code for the country you are calling. For example, when calling another country from the US, you must dial 011.

CONSTRUCTOR

new($country)

Constructs a new Number::Phone::CountryCode object. $country is the two digit ISO 3166 country code for the country you wish to look up. Returns undef if the country code did not match one of the supported countries.

METHODS

The following methods are available

country

the ISO 3166 country code for this country

country_code

The national prefix for this country

ndd_prefix

The NDD prefix for this country. Note that this might be undef if no prefix is necessary.

idd_prefix

The IDD prefix for this country. Note that this might be undef if no prefix is necessary.

CLASS METHODS

The following class methods are available (may be called without constructing an object).

countries

Returns a list of all ISO 3166 country codes supported by this module.

is_supported($country)

Returns true if the given country is supported, false otherwise. $country is a 2 character ISO 3166 country code.

SOURCE

You can contribute to or fork this project via github:

http://github.com/mschout/number-phone-countrycode/tree/master

 git clone git://github.com/mschout/number-phone-countrycode.git

BUGS / FEEDBACK

Please report any bugs or feature requests to bug-number-phone-countrycode@rt.cpan.org, or through the web interface at http://rt.cpan.org

I welcome feedback, and additions/corrections to the country code data contained within this module.

AUTHOR

Michael Schout, <mschout@gkg.net<gt>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Michael Schout

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.