Jess Robinson > Locale-Object-0.78 > Locale::Object::Continent

Download:
Locale-Object-0.78.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  10
Open  4
View/Report Bugs
Module Version: 0.78   Source   Latest Release: Locale-Object-0.79

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 ^

Earle Martin <hex@cpan.org>

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

CREDITS ^

See the credits for Locale::Object.

LEGAL ^

Copyright 2003-2007 Earle Martin. All rights reserved.

This module is released under the same license as Perl itself, and is provided on an "as is" basis. No warranty of any kind is made, either expressed or implied, as to the accuracy and/or utility of any results obtained from its use. However, if you do find something wrong with the results, please let the author know. Thanks.

syntax highlighting: