NAME

Locale::Object::Country - country information objects

VERSION

0.32

DESCRIPTION

Locale::Object::Country allows you to create objects containing information about countries such as their ISO codes, currencies and so on.

SYNOPSIS

    use Locale::Object::Country;
    
    my $country = Locale::Object::Country->new( code_alpha2 => 'af' );
    
    my $name         = $country->name;         # 'Afghanistan'
    my $code_alpha3  = $country->code_alpha3;  # 'afg'
    my $dialing_code = $country->dialing_code; # '93'
    
    my $currency     = $country->currency;
    my $continent    = $country->continent;

    my @languages    = $country->languages;

METHODS

new()

    my $country = Locale::Object::Country->new( code => 'af' );
    

The new method creates an object. It takes a single-item hash as an argument - valid options to pass are ISO 3166 values - 'code_alpha2', 'code_alpha3', 'code_numeric' and 'name'. See Locale::Object::DB::Schemata for details on these.

The objects created are singletons; if you try and create a country object when one matching your specification already exists, new() will return the original one.

code_alpha2(), code_alpha(), code_numeric(), name(), dialing_code(), utc_offset_main(), utc_offsets_all()

    my $name = $country->name;
    

These methods retrieve the values of the attributes whose name they share in the object.

currency(), continent()

These methods return Locale::Object::Currency and Locale::Object::Continent objects respectively. Both of those have their own attribute methods, so you can do things like this:

    my $currency      = $country->currency;
    my $currency_name = $currency->name;

See the documentation for those two modules for a listing of currency and continent attributes.

Note: More attributes will be added in a future release; see Locale::Object::DB::Schemata for a full listing of the contents of the database.

languages()

    my @languages = $country->languages;

Returns an array of Locale::Object::Language objects 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 $lang (@languages)
    {
      print $lang->name, "\n";
    }

If you use the official() method of a Locale::Object::Language object on a country object, it will return a boolean value describing whether the language is official in that country.

AUTHOR

Earle Martin <EMARTIN@cpan.org>

http://purl.oclc.org/net/earlemartin/

CREDITS

See the credits for Locale::Object.

LEGAL

Copyright 2003 Fotango Ltd. All rights reserved. http://opensource.fotango.com/

This module is released under the same license as Perl itself, and is provided on an "as is" basis. The author and Fotango Ltd make no warranties of any kind, 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.