Locale::Object::Continent - continent information objects


Locale-Object documentation  | view source Contained in the Locale-Object distribution.

Index


NAME

Top

Locale::Object::Continent - continent information objects

DESCRIPTION

Top

Locale::Object::Continent allows you to create objects representing continents, that contain other objects representing the continent in question's countries.

SYNOPSIS

Top

    my $asia      = Locale::Object::Continent->new( name => 'Asia' );

    my $name      = $asia->name;
    my @countries = $asia->countries;

METHODS

Top

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

Top

Earle Martin <hex@cpan.org>

http://downlode.org/Code/Perl/

CREDITS

Top

See the credits for Locale::Object.

LEGAL

Top


Locale-Object documentation  | view source Contained in the Locale-Object distribution.