|CountryCode(3pm)||User Contributed Perl Documentation||CountryCode(3pm)|
NCC::CountryCode - Perl extension for blah blah blah
use NCC::CountryCode; my $cc = new NCC::CountryCode(); my $cc_hash = $cc->getCCs(); print ($cc->isCC('NL')) ? "exists" : "non-existing"; $cc->CC2Country('fr'); $cc->Country2CC('russia');
This module provides class and several methods to simplify mapping between country names and country codes, as they assigned in the ISO3166.
The CC2Country() method maps country code to the corresponding country name or empty string, if it doesn\'t exist.
The Country2CC() tries to map passed country name into country code. As the spelling of the name may vary, this function tries to find all possible matches for passed name. In array context method returns hash of country codes and names, in scalar - a string, containing all possible country codes and corresponding country names.
The isCC() method verifies, that passed country code is a legal one and returns it in upper case. Otherwise it returns empty string.
The getCCs() method returns the reference to the internal hash, that contains all the country codes with corresponding them country names.
In addition to the country codes defined by ISO3166 standard this module also introduce 'UK' as a synonim for 'GB' and 'EU' as additional 'virtual' name for the Europe itself.
Timur Bakeyev, firstname.lastname@example.org