#
# Locale::Country - ISO codes for country identification (ISO 3166)
#
# $Id: Country.pm,v 2.6 2002/07/10 16:33:27 neilb Exp $
#
use strict;
require 5.002;
require Exporter;
use Carp;
#-----------------------------------------------------------------------
# Public Global Variables
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Private Global Variables
#-----------------------------------------------------------------------
my $CODES = [];
my $COUNTRIES = [];
#=======================================================================
#
# code2country ( CODE [, CODESET ] )
#
#=======================================================================
sub code2country
{
my $code = shift;
return undef unless defined $code;
#-------------------------------------------------------------------
# Make sure the code is in the right form before we use it
# to look up the corresponding country.
# We have to sprintf because the codes are given as 3-digits,
# with leading 0's. Eg 052 for Barbados.
#-------------------------------------------------------------------
if ($codeset == LOCALE_CODE_NUMERIC)
{
return undef if ($code =~ /\D/);
}
else
{
}
{
}
else
{
#---------------------------------------------------------------
# no such country code!
#---------------------------------------------------------------
return undef;
}
}
#=======================================================================
#
# country2code ( NAME [, CODESET ] )
#
#=======================================================================
sub country2code
{
my $country = shift;
return undef unless defined $country;
{
}
else
{
#---------------------------------------------------------------
# no such country!
#---------------------------------------------------------------
return undef;
}
}
#=======================================================================
#
# country_code2code ( NAME [, CODESET ] )
#
#=======================================================================
{
(@_ == 3) or croak "country_code2code() takes 3 arguments!";
my $code = shift;
my $inset = shift;
my $outset = shift;
my $outcode;
my $country;
return undef if not defined $country;
return $outcode;
}
#=======================================================================
#
# all_country_codes ( [ CODESET ] )
#
#=======================================================================
{
}
#=======================================================================
#
# all_country_names ( [ CODESET ] )
#
#=======================================================================
{
}
#=======================================================================
#
# alias_code ( ALIAS => CODE [ , CODESET ] )
#
# Add an alias for an existing code. If the CODESET isn't specified,
# then we use the default (currently the alpha-2 codeset).
#
# Locale::Country::alias_code('uk' => 'gb');
#
#=======================================================================
sub alias_code
{
my $alias = shift;
my $real = shift;
my $country;
{
carp "attempt to alias \"$alias\" to unknown country code \"$real\"\n";
return undef;
}
return $alias;
}
# old name of function for backwards compatibility
*_alias_code = *alias_code;
#=======================================================================
#
# rename_country
#
# change the official name for a country, eg:
# gb => 'Great Britain'
# rather than the standard 'United Kingdom'. The original is retained
# as an alias, but the new name will be returned if you lookup the
# name from code.
#
#=======================================================================
sub rename_country
{
my $code = shift;
my $new_name = shift;
my $country;
my $c;
if (not defined $codeset)
{
carp "rename_country(): unknown country code \"$code\"\n";
return 0;
}
foreach my $cset (LOCALE_CODE_ALPHA_2,
{
{
$c = $code;
}
else
{
}
}
return 1;
}
#=======================================================================
#
# _code2codeset
#
# given a country code in an unknown codeset, return the codeset
# it is from, or undef.
#
#=======================================================================
sub _code2codeset
{
my $code = shift;
{
}
return undef;
}
#=======================================================================
#
# initialisation code - stuff the DATA into the ALPHA2 hash
#
#=======================================================================
{
local $_;
while (<DATA>)
{
next unless /\S/;
chop;
{
}
if ($alpha3)
{
{
}
}
if ($numeric)
{
{
}
}
}
close(DATA);
}
1;
mk:mkd:807:Macedonia, the Former Yugoslav Republic of:Macedonia, Former Yugoslav Republic of:Macedonia