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

NAME

Locale::Object::Currency - currency information objects

VERSION

0.1

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::Currency;

    my $usd = Locale::Object::Currency->new( country_code => 'us' );

    my $name           = $usd->name;
    my $code           = $usd->code;
    my $code_numeric   = $usd->code_numeric;
    my $symbol         = $usd->symbol;
    my $subunit        = $usd->subunit;
    my $subunit_amount = $usd->subunit_amount;
    
    my %countries = %{$usd->countries};

METHODS

new()

    my $usd = Locale::Object::Currency->new( country_code => 'us' );

The new method creates an object. It takes a single-item hash as an argument - valid options to pass are ISO 3166 values - 'code', 'code_numeric' and 'name', and also 'country_code', which is an alpha2 country code (see Locale::Object::DB::Schemata for details on these). If you give a country code, a currency object will be created representing the currency of the country you specified.

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

name, code, code_numeric, symbol, subunit, subunit_amount

    my $name = $country->name;
    

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

countries

    my %countries = %{$usd->countries};

Returns a hash of Locale::Object::Country objects with their ISO 3166 alpha2 codes as keys (see Locale::Object::DB::Schemata for more details on those) for all countries using this currency. These have their own attribute methods, so you can do things like this for example:

    foreach my $country (sort keys %countries)
    {
      print "- ", $countries{$country}->name, "\n";
    }
    
    # prints:
    # - American Samoa
    # - Guam
    # - Palau
    # - Puerto Rico 
    # - Turks and Caicos Islands
    # - United States 
    # - Virgin Islands, British
    # - Virgin Islands, U.S.
    

See the documentation for Locale::Object::Country for a listing of country attributes.

KNOWN BUGS

The database of currency information is not perfect by a long stretch. If you find mistakes or missing information, please send them to the author.

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.