/usr/share/perl5/OpenSRS/Currency.pm is in libopensrs-perl 3.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 | #-----------------------------------------------------------------------
=head1 NAME
Locale::Currency - ISO three letter codes for currency identification (ISO 4217)
=head1 SYNOPSIS
use Locale::Currency;
$curr = code2currency('usd'); # $curr gets 'US Dollar'
$code = currency2code('Euro'); # $code gets 'eur'
@codes = all_currency_codes();
@names = all_currency_names();
=cut
#-----------------------------------------------------------------------
package Locale::Currency;
use strict;
require 5.002;
#-----------------------------------------------------------------------
=head1 DESCRIPTION
The C<Locale::Currency> module provides access to the ISO three-letter
codes for identifying currencies and funds, as defined in ISO 4217.
You can either access the codes via the L<conversion routines>
(described below),
or with the two functions which return lists of all currency codes or
all currency names.
There are two special codes defined by the standard which aren't
understood by this module:
=over 4
=item XTS
Specifically reserved for testing purposes.
=item XXX
For transactions where no currency is involved.
=back
=cut
#-----------------------------------------------------------------------
require Exporter;
#-----------------------------------------------------------------------
# Public Global Variables
#-----------------------------------------------------------------------
use vars qw($VERSION @ISA @EXPORT);
$VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
@ISA = qw(Exporter);
@EXPORT = qw(&code2currency ¤cy2code
&all_currency_codes &all_currency_names );
#-----------------------------------------------------------------------
# Private Global Variables
#-----------------------------------------------------------------------
my %CODES = ();
my %CURRENCIES = ();
#=======================================================================
=head1 CONVERSION ROUTINES
There are two conversion routines: C<code2currency()> and C<currency2code()>.
=over 8
=item code2currency()
This function takes a three letter currency code and returns a string
which contains the name of the currency identified. If the code is
not a valid currency code, as defined by ISO 4217, then C<undef>
will be returned.
$curr = code2currency($code);
=item currency2code()
This function takes a currency name and returns the corresponding
three letter currency code, if such exists.
If the argument could not be identified as a currency name,
then C<undef> will be returned.
$code = currency2code('French Franc');
The case of the currency name is not important.
See the section L<KNOWN BUGS AND LIMITATIONS> below.
=back
=cut
#=======================================================================
sub code2currency
{
my $code = shift;
return undef unless defined $code;
$code = lc($code);
if (exists $CODES{$code})
{
return $CODES{$code};
}
else
{
#---------------------------------------------------------------
# no such currency code!
#---------------------------------------------------------------
return undef;
}
}
sub currency2code
{
my $curr = shift;
return undef unless defined $curr;
$curr = lc($curr);
if (exists $CURRENCIES{$curr})
{
return $CURRENCIES{$curr};
}
else
{
#---------------------------------------------------------------
# no such currency!
#---------------------------------------------------------------
return undef;
}
}
#=======================================================================
=head1 QUERY ROUTINES
There are two function which can be used to obtain a list of all
currency codes, or all currency names:
=over 8
=item C<all_currency_codes()>
Returns a list of all three-letter currency codes.
The codes are guaranteed to be all lower-case,
and not in any particular order.
=item C<all_currency_names()>
Returns a list of all currency names for which there is a corresponding
three-letter currency code. The names are capitalised, and not returned
in any particular order.
=back
=cut
#=======================================================================
sub all_currency_codes
{
return keys %CODES;
}
sub all_currency_names
{
return values %CODES;
}
#-----------------------------------------------------------------------
=head1 EXAMPLES
The following example illustrates use of the C<code2currency()> function.
The user is prompted for a currency code, and then told the corresponding
currency name:
$| = 1; # turn off buffering
print "Enter currency code: ";
chop($code = <STDIN>);
$curr = code2currency($code);
if (defined $curr)
{
print "$code = $curr\n";
}
else
{
print "'$code' is not a valid currency code!\n";
}
=head1 KNOWN BUGS AND LIMITATIONS
=over 4
=item *
In the current implementation, all data is read in when the
module is loaded, and then held in memory.
A lazy implementation would be more memory friendly.
=item *
This module also includes the special codes which are
not for a currency, such as Gold, Platinum, etc.
This might cause a problem if you're using this module
to display a list of currencies.
Let Neil know if this does cause a problem, and we can
do something about it.
=item *
ISO 4217 also defines a numeric code for each currency.
Currency codes are not currently supported by this module.
=item *
There are three cases where there is more than one
code for the same currency name.
Kwacha has two codes: mwk for Malawi, and zmk for Zambia.
The Russian Ruble has two codes: rub and rur.
The Belarussian Ruble has two codes: byr and byb.
The currency2code() function only returns one code, so
you might not get back the code you expected.
=back
=head1 SEE ALSO
=over 4
=item Locale::Country
ISO codes for identification of country (ISO 3166).
Supports alpha-2, alpha-3, and numeric codes.
The currency codes use the alpha-2 codeset.
=item ISO 4217:1995
Code for the representation of currencies and funds.
=item http://www.bsi-global.com/iso4217currency
Official web page for the ISO 4217 maintenance agency.
This has the latest list of codes, in MS Word format. Boo.
=back
=head1 AUTHOR
Michael Hennecke E<lt>hennecke@rz.uni-karlsruhe.deE<gt>
and
Neil Bowers E<lt>neilb@cre.canon.co.ukE<gt>
=head1 COPYRIGHT
Copyright (c) 2001 Michael Hennecke and
Canon Research Centre Europe (CRE).
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
#-----------------------------------------------------------------------
#=======================================================================
# initialisation code - stuff the DATA into the CODES hash
#=======================================================================
{
my $code;
my $currency;
while (<DATA>)
{
next unless /\S/;
chop;
($code, $currency) = split(/:/, $_, 2);
$CODES{$code} = $currency;
$CURRENCIES{"\L$currency"} = $code;
}
}
1;
__DATA__
adp:Andorran Peseta
aed:UAE Dirham
afa:Afghani
all:Lek
amd:Armenian Dram
ang:Netherlands Antillean Guilder
aoa:Kwanza
aon:New Kwanza
aor:Kwanza Reajustado
ars:Argentine Peso
ats:Schilling
aud:Australian Dollar
awg:Aruban Guilder
azm:Azerbaijanian Manat
bam:Convertible Marks
bbd:Barbados Dollar
bdt:Taka
bef:Belgian Franc
bgl:Lev
bgn:Bulgarian Lev
bhd:Bahraini Dinar
bhd:Dinar
bif:Burundi Franc
bmd:Bermudian Dollar
bnd:Brunei Dollar
bob:Boliviano
bov:MVDol
brl:Brazilian Real
bsd:Bahamian Dollar
btn:Ngultrum
bwp:Pula
byb:Belarussian Ruble
byr:Belarussian Ruble
bzd:Belize Dollar
cad:Candian Dollar
cdf:Franc Congolais
chf:Swiss Franc
clf:Unidades de Formento
clp:Chilean Peso
cny:Yuan Renminbi
cop:Colombian Peso
crc:Costa Rican Colon
cup:Cuban Peso
cve:Cape Verde Escudo
cyp:Cyprus Pound
czk:Czech Koruna
dem:German Mark
djf:Djibouti Franc
dkk:Danish Krone
dop:Dominican Peso
dzd:Algerian Dinar
ecs:Sucre
ecv:Unidad de Valor Constante (UVC)
eek:Kroon
egp:Egyptian Pound
ern:Nakfa
esp:Spanish Peseta
etb:Ethiopian Birr
eur:Euro
fim:Markka
fjd:Fiji Dollar
fkp:Falkland Islands Pound
frf:French Franc
gbp:Pound Sterling
gel:Lari
ghc:Cedi
gip:Gibraltar Pound
gmd:Dalasi
gnf:Guinea Franc
grd:Drachma
gtq:Quetzal
gwp:Guinea-Bissau Peso
gyd:Guyana Dollar
hkd:Hong Kong Dollar
hnl:Lempira
hrk:Kuna
htg:Gourde
huf:Forint
idr:Rupiah
iep:Irish Pound
ils:Shekel
inr:Indian Rupee
iqd:Iraqi Dinar
irr:Iranian Rial
isk:Iceland Krona
itl:Italian Lira
jmd:Jamaican Dollar
jod:Jordanian Dinar
jpy:Yen
kes:Kenyan Shilling
kgs:Som
khr:Riel
kmf:Comoro Franc
kpw:North Korean Won
krw:Won
kwd:Kuwaiti Dinar
kyd:Cayman Islands Dollar
kzt:Tenge
lak:Kip
lbp:Lebanese Pound
lkr:Sri Lanka Rupee
lrd:Liberian Dollar
lsl:Loti
ltl:Lithuanian Litas
luf:Luxembourg Franc
lvl:Latvian Lats
lyd:Libyan Dinar
mad:Moroccan Dirham
mdl:Moldovan Leu
mgf:Malagasy Franc
mkd:Denar
mmk:Kyat
mnt:Tugrik
mop:Pataca
mro:Ouguiya
mtl:Maltese Lira
mur:Mauritius Rupee
mvr:Rufiyaa
mwk:Kwacha
mxn:Mexican Nuevo Peso
myr:Malaysian Ringgit
mzm:Metical
nad:Namibia Dollar
ngn:Naira
nio:Cordoba Oro
nlg:Netherlands Guilder
nok:Norwegian Krone
npr:Nepalese Rupee
nzd:New Zealand Dollar
omr:Rial Omani
pab:Balboa
pen:Nuevo Sol
pgk:Kina
php:Philippine Peso
pkr:Pakistan Rupee
pln:Zloty
pte:Portuguese Escudo
pyg:Guarani
qar:Qatari Rial
rol:Leu
rub:Russian Ruble
rur:Russian Ruble
rwf:Rwanda Franc
sar:Saudi Riyal
sbd:Solomon Islands Dollar
scr:Seychelles Rupee
sdd:Sudanese Dinar
sek:Swedish Krona
sgd:Singapore Dollar
shp:St. Helena Pound
sit:Tolar
skk:Slovak Koruna
sll:Leone
sos:Somali Shilling
srg:Surinam Guilder
std:Dobra
svc:El Salvador Colon
syp:Syrian Pound
szl:Lilangeni
thb:Baht
tjr:Tajik Ruble
tmm:Manat
tnd:Tunisian Dollar
top:Pa'anga
tpe:Timor Escudo
trl:Turkish Lira
ttd:Trinidad and Tobago Dollar
twd:New Taiwan Dollar
tzs:Tanzanian Shilling
uah:Hryvnia
uak:Karbovanets
ugx:Uganda Shilling
usd:US Dollar
usn:US Dollar (Next day)
uss:US Dollar (Same day)
uyu:Peso Uruguayo
uzs:Uzbekistan Sum
veb:Bolivar
vnd:Dong
vuv:Vatu
wst:Tala
xaf:CFA Franc BEAC
xag:Silver
xau:Gold
xba:European Composite Unit
xbb:European Monetary Unit
xbc:European Unit of Account 9
xb5:European Unit of Account 17
xcd:East Caribbean Dollar
xdr:SDR
xeu:ECU (until 1998-12-31)
xfu:UIC-Franc
xfo:Gold-Franc
xof:CFA Franc BCEAO
xpd:Palladium
xpf:CFP Franc
xpt:Platinum
yer:Yemeni Rial
yum:New Dinar
zal:Financial Rand
zar:Rand
zmk:Kwacha
zrn:New Zaire
zwd:Zimbabwe Dollar
|