Upgrade to Locale::Codes 2.01.
[p5sagit/p5-mst-13.2.git] / lib / Locale / Currency.pm
1 #
2 # Locale::Currency - ISO three letter codes for currency identification
3 #                    (ISO 4217)
4 #
5 # $Id: Currency.pm,v 2.1 2002/02/06 04:07:10 neilb Exp $
6 #
7
8 package Locale::Currency;
9 use strict;
10 require 5.002;
11
12 require Exporter;
13
14 #-----------------------------------------------------------------------
15 #       Public Global Variables
16 #-----------------------------------------------------------------------
17 use vars qw($VERSION @ISA @EXPORT);
18 $VERSION      = sprintf("%d.%02d", q$Revision: 2.1 $ =~ /(\d+)\.(\d+)/);
19 @ISA          = qw(Exporter);
20 @EXPORT       = qw(&code2currency &currency2code
21                    &all_currency_codes &all_currency_names );
22
23 #-----------------------------------------------------------------------
24 #       Private Global Variables
25 #-----------------------------------------------------------------------
26 my %CODES      = ();
27 my %CURRENCIES = ();
28
29
30 #=======================================================================
31 #
32 # code2currency( CODE )
33 #
34 #=======================================================================
35 sub code2currency
36 {
37     my $code = shift;
38
39
40     return undef unless defined $code;
41     $code = lc($code);
42     if (exists $CODES{$code})
43     {
44         return $CODES{$code};
45     }
46     else
47     {
48         #---------------------------------------------------------------
49         # no such currency code!
50         #---------------------------------------------------------------
51         return undef;
52     }
53 }
54
55
56 #=======================================================================
57 #
58 # currency2code ( CURRENCY )
59 #
60 #=======================================================================
61 sub currency2code
62 {
63     my $curr = shift;
64
65
66     return undef unless defined $curr;
67     $curr = lc($curr);
68     if (exists $CURRENCIES{$curr})
69     {
70         return $CURRENCIES{$curr};
71     }
72     else
73     {
74         #---------------------------------------------------------------
75         # no such currency!
76         #---------------------------------------------------------------
77         return undef;
78     }
79 }
80
81
82 #=======================================================================
83 #
84 # all_currency_codes()
85 #
86 #=======================================================================
87 sub all_currency_codes
88 {
89     return keys %CODES;
90 }
91
92
93 #=======================================================================
94 #
95 # all_currency_names()
96 #
97 #=======================================================================
98 sub all_currency_names
99 {
100     return values %CODES;
101 }
102
103
104 #=======================================================================
105 # initialisation code - stuff the DATA into the CODES hash
106 #=======================================================================
107 {
108     my $code;
109     my $currency;
110
111
112     while (<DATA>)
113     {
114         next unless /\S/;
115         chop;
116         ($code, $currency) = split(/:/, $_, 2);
117         $CODES{$code} = $currency;
118         $CURRENCIES{"\L$currency"} = $code;
119     }
120 }
121
122 1;
123
124 __DATA__
125 adp:Andorran Peseta
126 aed:UAE Dirham
127 afa:Afghani
128 all:Lek
129 amd:Armenian Dram
130 ang:Netherlands Antillean Guilder
131 aoa:Kwanza
132 aon:New Kwanza
133 aor:Kwanza Reajustado
134 ars:Argentine Peso
135 ats:Schilling
136 aud:Australian Dollar
137 awg:Aruban Guilder
138 azm:Azerbaijanian Manat
139
140 bam:Convertible Marks
141 bbd:Barbados Dollar
142 bdt:Taka
143 bef:Belgian Franc
144 bgl:Lev
145 bgn:Bulgarian Lev
146 bhd:Bahraini Dinar
147 bhd:Dinar
148 bif:Burundi Franc
149 bmd:Bermudian Dollar
150 bnd:Brunei Dollar
151 bob:Boliviano
152 bov:MVDol
153 brl:Brazilian Real
154 bsd:Bahamian Dollar
155 btn:Ngultrum
156 bwp:Pula
157 byb:Belarussian Ruble
158 byr:Belarussian Ruble
159 bzd:Belize Dollar
160
161 cad:Candian Dollar
162 cdf:Franc Congolais
163 chf:Swiss Franc
164 clf:Unidades de Formento
165 clp:Chilean Peso
166 cny:Yuan Renminbi
167 cop:Colombian Peso
168 crc:Costa Rican Colon
169 cup:Cuban Peso
170 cve:Cape Verde Escudo
171 cyp:Cyprus Pound
172 czk:Czech Koruna
173
174 dem:German Mark
175 djf:Djibouti Franc
176 dkk:Danish Krone
177 dop:Dominican Peso
178 dzd:Algerian Dinar
179
180 ecs:Sucre
181 ecv:Unidad de Valor Constante (UVC)
182 eek:Kroon
183 egp:Egyptian Pound
184 ern:Nakfa
185 esp:Spanish Peseta
186 etb:Ethiopian Birr
187 eur:Euro
188
189 fim:Markka
190 fjd:Fiji Dollar
191 fkp:Falkland Islands Pound
192 frf:French Franc
193
194 gbp:Pound Sterling
195 gel:Lari
196 ghc:Cedi
197 gip:Gibraltar Pound
198 gmd:Dalasi
199 gnf:Guinea Franc
200 grd:Drachma
201 gtq:Quetzal
202 gwp:Guinea-Bissau Peso
203 gyd:Guyana Dollar
204
205 hkd:Hong Kong Dollar
206 hnl:Lempira
207 hrk:Kuna
208 htg:Gourde
209 huf:Forint
210
211 idr:Rupiah
212 iep:Irish Pound
213 ils:Shekel
214 inr:Indian Rupee
215 iqd:Iraqi Dinar
216 irr:Iranian Rial
217 isk:Iceland Krona
218 itl:Italian Lira
219
220 jmd:Jamaican Dollar
221 jod:Jordanian Dinar
222 jpy:Yen
223
224 kes:Kenyan Shilling
225 kgs:Som
226 khr:Riel
227 kmf:Comoro Franc
228 kpw:North Korean Won
229 krw:Won
230 kwd:Kuwaiti Dinar
231 kyd:Cayman Islands Dollar
232 kzt:Tenge
233
234 lak:Kip
235 lbp:Lebanese Pound
236 lkr:Sri Lanka Rupee
237 lrd:Liberian Dollar
238 lsl:Loti
239 ltl:Lithuanian Litas
240 luf:Luxembourg Franc
241 lvl:Latvian Lats
242 lyd:Libyan Dinar
243
244 mad:Moroccan Dirham
245 mdl:Moldovan Leu
246 mgf:Malagasy Franc
247 mkd:Denar
248 mmk:Kyat
249 mnt:Tugrik
250 mop:Pataca
251 mro:Ouguiya
252 mtl:Maltese Lira
253 mur:Mauritius Rupee
254 mvr:Rufiyaa
255 mwk:Kwacha
256 mxn:Mexican Nuevo Peso
257 myr:Malaysian Ringgit
258 mzm:Metical
259
260 nad:Namibia Dollar
261 ngn:Naira
262 nio:Cordoba Oro
263 nlg:Netherlands Guilder
264 nok:Norwegian Krone
265 npr:Nepalese Rupee
266 nzd:New Zealand Dollar
267
268 omr:Rial Omani
269
270 pab:Balboa
271 pen:Nuevo Sol
272 pgk:Kina
273 php:Philippine Peso
274 pkr:Pakistan Rupee
275 pln:Zloty
276 pte:Portuguese Escudo
277 pyg:Guarani
278
279 qar:Qatari Rial
280
281 rol:Leu
282 rub:Russian Ruble
283 rur:Russian Ruble
284 rwf:Rwanda Franc
285
286 sar:Saudi Riyal
287 sbd:Solomon Islands Dollar
288 scr:Seychelles Rupee
289 sdd:Sudanese Dinar
290 sek:Swedish Krona
291 sgd:Singapore Dollar
292 shp:St. Helena Pound
293 sit:Tolar
294 skk:Slovak Koruna
295 sll:Leone
296 sos:Somali Shilling
297 srg:Surinam Guilder
298 std:Dobra
299 svc:El Salvador Colon
300 syp:Syrian Pound
301 szl:Lilangeni
302
303 thb:Baht
304 tjr:Tajik Ruble
305 tmm:Manat
306 tnd:Tunisian Dollar
307 top:Pa'anga
308 tpe:Timor Escudo
309 trl:Turkish Lira
310 ttd:Trinidad and Tobago Dollar
311 twd:New Taiwan Dollar
312 tzs:Tanzanian Shilling
313
314 uah:Hryvnia
315 uak:Karbovanets
316 ugx:Uganda Shilling
317 usd:US Dollar
318 usn:US Dollar (Next day)
319 uss:US Dollar (Same day)
320 uyu:Peso Uruguayo
321 uzs:Uzbekistan Sum
322
323 veb:Bolivar
324 vnd:Dong
325 vuv:Vatu
326
327 wst:Tala
328
329 xaf:CFA Franc BEAC
330 xag:Silver
331 xau:Gold
332 xba:European Composite Unit
333 xbb:European Monetary Unit
334 xbc:European Unit of Account 9
335 xb5:European Unit of Account 17
336 xcd:East Caribbean Dollar
337 xdr:SDR
338 xeu:ECU (until 1998-12-31)
339 xfu:UIC-Franc
340 xfo:Gold-Franc
341 xof:CFA Franc BCEAO
342 xpd:Palladium
343 xpf:CFP Franc
344 xpt:Platinum
345
346 yer:Yemeni Rial
347 yum:New Dinar
348
349 zal:Financial Rand
350 zar:Rand
351 zmk:Kwacha
352 zrn:New Zaire
353 zwd:Zimbabwe Dollar