1N/A
1N/A=head1 NAME
1N/A
1N/ALocale::Currency - ISO three letter codes for currency identification (ISO 4217)
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A use Locale::Currency;
1N/A
1N/A $curr = code2currency('usd'); # $curr gets 'US Dollar'
1N/A $code = currency2code('Euro'); # $code gets 'eur'
1N/A
1N/A @codes = all_currency_codes();
1N/A @names = all_currency_names();
1N/A
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AThe C<Locale::Currency> module provides access to the ISO three-letter
1N/Acodes for identifying currencies and funds, as defined in ISO 4217.
1N/AYou can either access the codes via the L<conversion routines>
1N/A(described below),
1N/Aor with the two functions which return lists of all currency codes or
1N/Aall currency names.
1N/A
1N/AThere are two special codes defined by the standard which aren't
1N/Aunderstood by this module:
1N/A
1N/A=over 4
1N/A
1N/A=item XTS
1N/A
1N/ASpecifically reserved for testing purposes.
1N/A
1N/A=item XXX
1N/A
1N/AFor transactions where no currency is involved.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 CONVERSION ROUTINES
1N/A
1N/AThere are two conversion routines: C<code2currency()> and C<currency2code()>.
1N/A
1N/A=over 4
1N/A
1N/A=item code2currency()
1N/A
1N/AThis function takes a three letter currency code and returns a string
1N/Awhich contains the name of the currency identified. If the code is
1N/Anot a valid currency code, as defined by ISO 4217, then C<undef>
1N/Awill be returned.
1N/A
1N/A $curr = code2currency($code);
1N/A
1N/A=item currency2code()
1N/A
1N/AThis function takes a currency name and returns the corresponding
1N/Athree letter currency code, if such exists.
1N/AIf the argument could not be identified as a currency name,
1N/Athen C<undef> will be returned.
1N/A
1N/A $code = currency2code('French Franc');
1N/A
1N/AThe case of the currency name is not important.
1N/ASee the section L<KNOWN BUGS AND LIMITATIONS> below.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 QUERY ROUTINES
1N/A
1N/AThere are two function which can be used to obtain a list of all
1N/Acurrency codes, or all currency names:
1N/A
1N/A=over 4
1N/A
1N/A=item C<all_currency_codes()>
1N/A
1N/AReturns a list of all three-letter currency codes.
1N/AThe codes are guaranteed to be all lower-case,
1N/Aand not in any particular order.
1N/A
1N/A=item C<all_currency_names()>
1N/A
1N/AReturns a list of all currency names for which there is a corresponding
1N/Athree-letter currency code. The names are capitalised, and not returned
1N/Ain any particular order.
1N/A
1N/A=back
1N/A
1N/A
1N/A=head1 EXAMPLES
1N/A
1N/AThe following example illustrates use of the C<code2currency()> function.
1N/AThe user is prompted for a currency code, and then told the corresponding
1N/Acurrency name:
1N/A
1N/A $| = 1; # turn off buffering
1N/A
1N/A print "Enter currency code: ";
1N/A chop($code = <STDIN>);
1N/A $curr = code2currency($code);
1N/A if (defined $curr)
1N/A {
1N/A print "$code = $curr\n";
1N/A }
1N/A else
1N/A {
1N/A print "'$code' is not a valid currency code!\n";
1N/A }
1N/A
1N/A=head1 KNOWN BUGS AND LIMITATIONS
1N/A
1N/A=over 4
1N/A
1N/A=item *
1N/A
1N/AIn the current implementation, all data is read in when the
1N/Amodule is loaded, and then held in memory.
1N/AA lazy implementation would be more memory friendly.
1N/A
1N/A=item *
1N/A
1N/AThis module also includes the special codes which are
1N/Anot for a currency, such as Gold, Platinum, etc.
1N/AThis might cause a problem if you're using this module
1N/Ato display a list of currencies.
1N/ALet Neil know if this does cause a problem, and we can
1N/Ado something about it.
1N/A
1N/A=item *
1N/A
1N/AISO 4217 also defines a numeric code for each currency.
1N/ACurrency codes are not currently supported by this module,
1N/Ain the same way Locale::Country supports multiple codesets.
1N/A
1N/A=item *
1N/A
1N/AThere are three cases where there is more than one
1N/Acode for the same currency name.
1N/AKwacha has two codes: mwk for Malawi, and zmk for Zambia.
1N/AThe Russian Ruble has two codes: rub and rur.
1N/AThe Belarussian Ruble has two codes: byr and byb.
1N/AThe currency2code() function only returns one code, so
1N/Ayou might not get back the code you expected.
1N/A
1N/A=back
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/A=over 4
1N/A
1N/A=item Locale::Country
1N/A
1N/AISO codes for identification of country (ISO 3166).
1N/A
1N/A=item Locale::Script
1N/A
1N/AISO codes for identification of written scripts (ISO 15924).
1N/A
1N/A=item ISO 4217:1995
1N/A
1N/ACode for the representation of currencies and funds.
1N/A
1N/A=item http://www.bsi-global.com/iso4217currency
1N/A
1N/AOfficial web page for the ISO 4217 maintenance agency.
1N/AThis has the latest list of codes, in MS Word format. Boo.
1N/A
1N/A=back
1N/A
1N/A=head1 AUTHOR
1N/A
1N/AMichael Hennecke E<lt>hennecke@rz.uni-karlsruhe.deE<gt>
1N/Aand
1N/ANeil Bowers E<lt>neil@bowers.comE<gt>
1N/A
1N/A=head1 COPYRIGHT
1N/A
1N/ACopyright (C) 2002, Neil Bowers.
1N/A
1N/ACopyright (c) 2001 Michael Hennecke and
1N/ACanon Research Centre Europe (CRE).
1N/A
1N/AThis module is free software; you can redistribute it and/or
1N/Amodify it under the same terms as Perl itself.
1N/A
1N/A=cut
1N/A