Locale::Object is an object-oriented representation of locale information.
The Locale::Object group of modules attempts to provide locale-related information in an object-oriented fashion. The information is collated from several sources and provided in an accompanying DBD::SQLite database.
At present, the modules are:
Locale::Object - make compound objects containing country, currency and language objects
Locale::Object::Country - objects representing countries
Locale::Object::Continent - objects representing continents
Locale::Object::Currency - objects representing currencies
Locale::Object::Currency::Converter - convert between currencies
Locale::Object::DB - does lookups for the modules in the database
Locale::Object::Language - objects representing languages
For more information, see the documentation for those modules. The database is documented in docs/database.pod. Locale::Object itself can be used to create compound objects containing country, currency and language objects.
SYNOPSIS
use Locale::Object;
my $obj = Locale::Object->new(
country_code_alpha2 => 'gb',
currency_code => 'GBP',
language_code_alpha2 => 'en'
);
$obj->country_code_alpha2('af');
$obj->country_code_alpha3('afg');
$obj->currency_code('AFA');
$obj->currency_code_numeric('004');
$obj->language_code_alpha2('ps');
$obj->language_code_alpha3('pus');
$obj->language_name('Pushto');
my $country = $obj->country;
my $currency = $obj->currency;
my $language = $obj->language;
$obj->empty('language');
print $obj->sane('country');
$obj->make_sane(
attribute => 'country'
populate => 1
);
METHODS
new()
my $obj = Locale::Object->new(
country_code_alpha2 => 'gb',
currency_code => 'GBP',
language_code_alpha2 => 'en'
);
Creates a new object. With no parameters, the object will be blank. Valid parameters match the method names that follow.
country_code_alpha2(), country_code_alpha3()
$obj->country_code_alpha2('af');
$obj->country_code_alpha3('afg');
Sets the country attribute in the object by alpha2 and alpha3 codes. Will create a new Locale::Object::Country object and set that as the attribute. Because Locale::Object::Country objects all have single instances, if one has already been created by that code, it will be reused when you do this.
country_code(), currency_code_numeric()
$obj->currency_code('AFA');
$obj->currency_code_numeric('004');
Serves the same purpose as the previous methods, only for the currency attribute, a Locale::Object::Currency object.
language_code_alpha2(), language_code_alpha3(), language_name()
$obj->language_code_alpha2('ps');
$obj->language_code_alpha3('pus');
$obj->language_name('Pushto');
Serves the same purpose as the previous methods, only for the language attribute, a Locale::Object::Language object.
Product's homepage
Requirements:
· Perl