The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Locale::Object::Country - OO locale information for countries

VERSION

0.2

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 $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(), name_native(), main_timezone(), uses_daylight_savings()

    my $name = $country->name;
    

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

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";
    }

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.