NAME
Locale::Object::Continent - continent information objects
DESCRIPTION
Locale::Object::Continent
allows you to create objects representing continents, that contain other objects representing the continent in question's countries.
SYNOPSIS
my $asia = Locale::Object::Continent->new( name => 'Asia' );
my $name = $asia->name;
my @countries = $asia->countries;
METHODS
new()
my $asia = Locale::Object::Continent->new( name => 'Asia' );
The new
method creates an object. It takes a single-item hash as an argument - the only valid options to it is 'name', which must be one of 'Africa', 'Asia', 'Europe', 'North America', 'Oceania' or 'South America'. Support for Antarctic territories is not currently provided.
The objects created are singletons; if you try and create a continent object when one matching your specification already exists, new()
will return the original one.
name()
my $name = $asia->name;
Retrieves the value of the continent object's name.
countries()
my @countries = $asia->countries;
Returns an array of Locale::Object::Country objects with their ISO 3166 alpha2 codes as keys (see Locale::Object::DB::Schemata for more details on those) in array context, or a reference in scalar context. The objects have their own attribute methods, so you can do things like this:
foreach my $place (@countries)
{
print $place->name, "\n";
}
Which will list you all the currencies used in that continent. See the documentation for Locale::Object::Country for a listing of country attributes. Note that you can chain methods as well.
foreach my $place (@countries)
{
print $place->currency->name, "\n";
}
AUTHOR
Originally by Earle Martin
COPYRIGHT AND LICENSE
Originally by Earle Martin. To the extent possible under law, the author has dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.