line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Get information for different currencies |
2
|
|
|
|
|
|
|
package Data::MoneyCurrency; |
3
|
|
|
|
|
|
|
$Data::MoneyCurrency::VERSION = '0.24'; |
4
|
3
|
|
|
3
|
|
250632
|
use strict; |
|
3
|
|
|
|
|
28
|
|
|
3
|
|
|
|
|
86
|
|
5
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
91
|
|
6
|
3
|
|
|
3
|
|
683
|
use utf8; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
26
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
require Exporter; |
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw(get_currency get_currencies_for_country); |
11
|
|
|
|
|
|
|
|
12
|
3
|
|
|
3
|
|
224
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
232
|
|
13
|
3
|
|
|
3
|
|
3233
|
use Cpanel::JSON::XS; |
|
3
|
|
|
|
|
18697
|
|
|
3
|
|
|
|
|
200
|
|
14
|
3
|
|
|
3
|
|
675
|
use Data::Dumper; |
|
3
|
|
|
|
|
7216
|
|
|
3
|
|
|
|
|
196
|
|
15
|
|
|
|
|
|
|
$Data::Dumper::Sortkeys = 1; |
16
|
3
|
|
|
3
|
|
1630
|
use File::ShareDir qw(dist_dir); |
|
3
|
|
|
|
|
83391
|
|
|
3
|
|
|
|
|
185
|
|
17
|
3
|
|
|
3
|
|
1590
|
use Types::Serialiser; |
|
3
|
|
|
|
|
4763
|
|
|
3
|
|
|
|
|
4004
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $confdir = dist_dir('Data-MoneyCurrency'); |
20
|
|
|
|
|
|
|
my $rh_currency_for_country = {}; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $rh_currency_iso; # contains character strings |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub get_currency { |
26
|
10
|
100
|
|
10
|
1
|
20268
|
croak "get_currency received no arguments" if @_ == 0; |
27
|
|
|
|
|
|
|
|
28
|
9
|
|
|
|
|
29
|
my %args = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
croak "get_currency cannot accept both currency and country" |
31
|
9
|
100
|
100
|
|
|
43
|
if $args{currency} && $args{country}; |
32
|
|
|
|
|
|
|
|
33
|
8
|
|
100
|
|
|
49
|
my $currency_abbreviation = lc(delete($args{currency}) || ""); |
34
|
8
|
|
100
|
|
|
25
|
my $country = lc(delete($args{country}) || ""); |
35
|
|
|
|
|
|
|
|
36
|
8
|
100
|
|
|
|
27
|
croak "get_currency only accepts currency OR country as args" |
37
|
|
|
|
|
|
|
if keys(%args) > 0; |
38
|
|
|
|
|
|
|
|
39
|
7
|
100
|
|
|
|
15
|
if (!$currency_abbreviation) { |
40
|
3
|
50
|
|
|
|
8
|
if ($country) { |
41
|
3
|
|
|
|
|
8
|
my $ra_currencies = get_currencies_for_country($country); |
42
|
3
|
100
|
|
|
|
12
|
if (!$ra_currencies) { |
|
|
50
|
|
|
|
|
|
43
|
1
|
|
|
|
|
3
|
return; |
44
|
|
|
|
|
|
|
} elsif (@$ra_currencies > 1) { |
45
|
0
|
|
|
|
|
0
|
croak "More than one currency known for country '$country'"; |
46
|
|
|
|
|
|
|
} |
47
|
2
|
|
|
|
|
5
|
$currency_abbreviation = $ra_currencies->[0]; |
48
|
|
|
|
|
|
|
} else { |
49
|
0
|
|
|
|
|
0
|
croak "Expected one of currency or country to be specified"; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
6
|
100
|
|
|
|
21
|
if (!defined($rh_currency_iso)) { |
54
|
|
|
|
|
|
|
# need to read the conf files |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# first the iso file |
57
|
1
|
|
|
|
|
8
|
my $iso_path = $confdir . '/currency_iso.json'; |
58
|
1
|
50
|
|
|
|
61
|
open my $fh, "<:raw", $iso_path or die $!; |
59
|
1
|
|
|
|
|
1814
|
my $octet_contents = join "", readline($fh); |
60
|
1
|
50
|
|
|
|
139
|
close $fh or die $!; |
61
|
1
|
|
|
|
|
1135
|
$rh_currency_iso = decode_json($octet_contents); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# now the non_iso |
64
|
1
|
|
|
|
|
6
|
my $non_iso_path = $confdir . '/currency_non_iso.json'; |
65
|
1
|
50
|
|
|
|
60
|
open $fh, "<:raw", $non_iso_path or die $!; |
66
|
1
|
|
|
|
|
69
|
$octet_contents = join "", readline($fh); |
67
|
1
|
50
|
|
|
|
21
|
close $fh or die $!; |
68
|
1
|
|
|
|
|
76
|
my $rh_non_iso = decode_json($octet_contents); |
69
|
1
|
|
|
|
|
17
|
foreach my $nic (keys %$rh_non_iso){ |
70
|
9
|
|
|
|
|
21
|
$rh_currency_iso->{$nic} = $rh_non_iso->{$nic}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
6
|
100
|
|
|
|
18
|
if (!$rh_currency_iso->{$currency_abbreviation}) { |
75
|
1
|
|
|
|
|
4
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Shallow copy everytime deliberately, so that the caller can mutate the |
79
|
|
|
|
|
|
|
# return value if wished, without affecting rh_currency_iso |
80
|
5
|
|
|
|
|
6
|
my $rv = {}; |
81
|
5
|
|
|
|
|
9
|
for my $key (keys %{$rh_currency_iso->{$currency_abbreviation}}) { |
|
5
|
|
|
|
|
21
|
|
82
|
67
|
|
|
|
|
97
|
my $value = $rh_currency_iso->{$currency_abbreviation}{$key}; |
83
|
67
|
100
|
66
|
|
|
96
|
if ( Cpanel::JSON::XS::is_bool($value) |
84
|
|
|
|
|
|
|
or Types::Serialiser::is_bool($value)) |
85
|
|
|
|
|
|
|
{ |
86
|
5
|
50
|
|
|
|
79
|
$value = $value ? 1 : 0; |
87
|
|
|
|
|
|
|
} |
88
|
67
|
|
|
|
|
743
|
$rv->{$key} = $value; |
89
|
|
|
|
|
|
|
} |
90
|
5
|
|
|
|
|
21
|
return $rv; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
my $rh_currencies_for_country = { |
94
|
|
|
|
|
|
|
ad => ['eur'], |
95
|
|
|
|
|
|
|
ae => ['aed'], |
96
|
|
|
|
|
|
|
af => ['afn'], |
97
|
|
|
|
|
|
|
ag => ['xcd'], |
98
|
|
|
|
|
|
|
ai => ['xcd'], |
99
|
|
|
|
|
|
|
al => ['all'], |
100
|
|
|
|
|
|
|
am => ['amd'], |
101
|
|
|
|
|
|
|
an => ['ang'], |
102
|
|
|
|
|
|
|
ao => ['aoa'], |
103
|
|
|
|
|
|
|
ar => ['ars'], |
104
|
|
|
|
|
|
|
as => ['usd'], |
105
|
|
|
|
|
|
|
at => ['eur'], |
106
|
|
|
|
|
|
|
au => ['aud'], |
107
|
|
|
|
|
|
|
aw => ['awg'], |
108
|
|
|
|
|
|
|
ax => ['eur'], |
109
|
|
|
|
|
|
|
az => ['azn'], |
110
|
|
|
|
|
|
|
ba => ['bam'], |
111
|
|
|
|
|
|
|
bb => ['bbd'], |
112
|
|
|
|
|
|
|
bd => ['bdt'], |
113
|
|
|
|
|
|
|
be => ['eur'], |
114
|
|
|
|
|
|
|
bf => ['xof'], |
115
|
|
|
|
|
|
|
bg => ['bgn'], |
116
|
|
|
|
|
|
|
bh => ['bhd'], |
117
|
|
|
|
|
|
|
bi => ['bif'], |
118
|
|
|
|
|
|
|
bj => ['xof'], |
119
|
|
|
|
|
|
|
bl => ['eur'], |
120
|
|
|
|
|
|
|
bm => ['bmd'], |
121
|
|
|
|
|
|
|
bn => ['bnd'], |
122
|
|
|
|
|
|
|
bo => ['bob'], |
123
|
|
|
|
|
|
|
bq => ['usd'], |
124
|
|
|
|
|
|
|
br => ['brl'], |
125
|
|
|
|
|
|
|
bs => ['bsd'], |
126
|
|
|
|
|
|
|
bt => ['btn'], |
127
|
|
|
|
|
|
|
bw => ['bwp'], |
128
|
|
|
|
|
|
|
by => ['byn'], |
129
|
|
|
|
|
|
|
bv => ['nok'], |
130
|
|
|
|
|
|
|
bz => ['bzd'], |
131
|
|
|
|
|
|
|
ca => ['cad'], |
132
|
|
|
|
|
|
|
cc => ['aud'], |
133
|
|
|
|
|
|
|
cd => ['cdf'], |
134
|
|
|
|
|
|
|
cf => ['xaf'], |
135
|
|
|
|
|
|
|
cg => ['xaf'], |
136
|
|
|
|
|
|
|
ch => ['chf'], |
137
|
|
|
|
|
|
|
ci => ['xof'], |
138
|
|
|
|
|
|
|
ck => ['nzd'], |
139
|
|
|
|
|
|
|
cl => ['clp'], |
140
|
|
|
|
|
|
|
cm => ['xaf'], |
141
|
|
|
|
|
|
|
cn => ['cny'], |
142
|
|
|
|
|
|
|
co => ['cop'], |
143
|
|
|
|
|
|
|
cr => ['crc'], |
144
|
|
|
|
|
|
|
cu => ['cuc', 'cup'], |
145
|
|
|
|
|
|
|
cv => ['cve'], |
146
|
|
|
|
|
|
|
cw => ['ang'], |
147
|
|
|
|
|
|
|
cx => ['aud'], |
148
|
|
|
|
|
|
|
cy => ['eur'], |
149
|
|
|
|
|
|
|
cz => ['czk'], |
150
|
|
|
|
|
|
|
de => ['eur'], |
151
|
|
|
|
|
|
|
dj => ['djf'], |
152
|
|
|
|
|
|
|
dk => ['dkk'], |
153
|
|
|
|
|
|
|
dm => ['xcd'], |
154
|
|
|
|
|
|
|
do => ['dop'], |
155
|
|
|
|
|
|
|
dy => ['xof'], |
156
|
|
|
|
|
|
|
dz => ['dzd'], |
157
|
|
|
|
|
|
|
ec => ['usd'], |
158
|
|
|
|
|
|
|
ee => ['eur'], |
159
|
|
|
|
|
|
|
eg => ['egp'], |
160
|
|
|
|
|
|
|
eh => ['mad'], |
161
|
|
|
|
|
|
|
er => ['ern'], |
162
|
|
|
|
|
|
|
es => ['eur'], |
163
|
|
|
|
|
|
|
et => ['etb'], |
164
|
|
|
|
|
|
|
fi => ['eur'], |
165
|
|
|
|
|
|
|
fj => ['fjd'], |
166
|
|
|
|
|
|
|
fk => ['fkp'], |
167
|
|
|
|
|
|
|
fm => ['usd'], |
168
|
|
|
|
|
|
|
fo => ['dkk'], |
169
|
|
|
|
|
|
|
fr => ['eur'], |
170
|
|
|
|
|
|
|
ga => ['xaf'], |
171
|
|
|
|
|
|
|
gb => ['gbp'], |
172
|
|
|
|
|
|
|
gd => ['xcd'], |
173
|
|
|
|
|
|
|
ge => ['gel'], |
174
|
|
|
|
|
|
|
gf => ['eur'], |
175
|
|
|
|
|
|
|
gg => ['gbp', 'ggp'], |
176
|
|
|
|
|
|
|
gh => ['ghs'], |
177
|
|
|
|
|
|
|
gi => ['gip'], |
178
|
|
|
|
|
|
|
gl => ['dkk'], |
179
|
|
|
|
|
|
|
gm => ['gmd'], |
180
|
|
|
|
|
|
|
gn => ['gnf'], |
181
|
|
|
|
|
|
|
gp => ['eur'], |
182
|
|
|
|
|
|
|
gq => ['xaf'], |
183
|
|
|
|
|
|
|
gr => ['eur'], |
184
|
|
|
|
|
|
|
gs => ['fkp'], |
185
|
|
|
|
|
|
|
gt => ['gtq'], |
186
|
|
|
|
|
|
|
gu => ['usd'], |
187
|
|
|
|
|
|
|
gw => ['xof'], |
188
|
|
|
|
|
|
|
gy => ['gyd'], |
189
|
|
|
|
|
|
|
hk => ['hkd'], |
190
|
|
|
|
|
|
|
hm => ['aud'], |
191
|
|
|
|
|
|
|
hn => ['hnl'], |
192
|
|
|
|
|
|
|
hr => ['hrk', 'eur'], |
193
|
|
|
|
|
|
|
ht => ['htg'], |
194
|
|
|
|
|
|
|
hu => ['huf'], |
195
|
|
|
|
|
|
|
id => ['idr'], |
196
|
|
|
|
|
|
|
ie => ['eur'], |
197
|
|
|
|
|
|
|
il => ['ils'], |
198
|
|
|
|
|
|
|
im => ['imp', 'gbp'], |
199
|
|
|
|
|
|
|
in => ['inr'], |
200
|
|
|
|
|
|
|
io => ['gbp'], |
201
|
|
|
|
|
|
|
iq => ['iqd'], |
202
|
|
|
|
|
|
|
ir => ['irr'], |
203
|
|
|
|
|
|
|
is => ['isk'], |
204
|
|
|
|
|
|
|
it => ['eur'], |
205
|
|
|
|
|
|
|
je => ['gbp', 'jep'], |
206
|
|
|
|
|
|
|
jm => ['jmd'], |
207
|
|
|
|
|
|
|
jo => ['jod'], |
208
|
|
|
|
|
|
|
jp => ['jpy'], |
209
|
|
|
|
|
|
|
ke => ['kes'], |
210
|
|
|
|
|
|
|
kg => ['kgs'], |
211
|
|
|
|
|
|
|
kh => ['khr'], |
212
|
|
|
|
|
|
|
ki => ['aud'], |
213
|
|
|
|
|
|
|
km => ['kmf'], |
214
|
|
|
|
|
|
|
kn => ['xcd'], |
215
|
|
|
|
|
|
|
kp => ['kpw'], |
216
|
|
|
|
|
|
|
kr => ['krw'], |
217
|
|
|
|
|
|
|
kw => ['kwd'], |
218
|
|
|
|
|
|
|
ky => ['kyd'], |
219
|
|
|
|
|
|
|
kz => ['kzt'], |
220
|
|
|
|
|
|
|
la => ['lak'], |
221
|
|
|
|
|
|
|
lb => ['lbp'], |
222
|
|
|
|
|
|
|
lc => ['xcd'], |
223
|
|
|
|
|
|
|
li => ['chf'], |
224
|
|
|
|
|
|
|
lk => ['lkr'], |
225
|
|
|
|
|
|
|
lr => ['lrd'], |
226
|
|
|
|
|
|
|
ls => ['lsl'], |
227
|
|
|
|
|
|
|
lt => ['eur'], |
228
|
|
|
|
|
|
|
lu => ['eur'], |
229
|
|
|
|
|
|
|
lv => ['eur'], |
230
|
|
|
|
|
|
|
ly => ['lyd'], |
231
|
|
|
|
|
|
|
ma => ['mad'], |
232
|
|
|
|
|
|
|
mc => ['eur'], |
233
|
|
|
|
|
|
|
md => ['mdl'], |
234
|
|
|
|
|
|
|
me => ['eur'], |
235
|
|
|
|
|
|
|
mf => ['eur'], |
236
|
|
|
|
|
|
|
mg => ['mga'], |
237
|
|
|
|
|
|
|
mh => ['usd'], |
238
|
|
|
|
|
|
|
mk => ['mkd'], |
239
|
|
|
|
|
|
|
ml => ['xof'], |
240
|
|
|
|
|
|
|
mm => ['mmk'], |
241
|
|
|
|
|
|
|
mn => ['mnt'], |
242
|
|
|
|
|
|
|
mo => ['mop'], |
243
|
|
|
|
|
|
|
mq => ['eur'], |
244
|
|
|
|
|
|
|
mr => ['mro'], |
245
|
|
|
|
|
|
|
ms => ['xcd'], |
246
|
|
|
|
|
|
|
mt => ['eur'], |
247
|
|
|
|
|
|
|
mu => ['mur'], |
248
|
|
|
|
|
|
|
mv => ['mvr'], |
249
|
|
|
|
|
|
|
mw => ['mwk'], |
250
|
|
|
|
|
|
|
mx => ['mxn'], |
251
|
|
|
|
|
|
|
'my' => ['myr'], |
252
|
|
|
|
|
|
|
mz => ['mzn'], |
253
|
|
|
|
|
|
|
na => ['nad'], |
254
|
|
|
|
|
|
|
nc => ['xpf'], |
255
|
|
|
|
|
|
|
ne => ['xof'], |
256
|
|
|
|
|
|
|
nf => ['aud'], |
257
|
|
|
|
|
|
|
ng => ['ngn'], |
258
|
|
|
|
|
|
|
ni => ['nio'], |
259
|
|
|
|
|
|
|
nl => ['eur'], |
260
|
|
|
|
|
|
|
no => ['nok'], |
261
|
|
|
|
|
|
|
np => ['npr'], |
262
|
|
|
|
|
|
|
nr => ['aud'], |
263
|
|
|
|
|
|
|
nu => ['nzd'], |
264
|
|
|
|
|
|
|
nz => ['nzd'], |
265
|
|
|
|
|
|
|
om => ['omr'], |
266
|
|
|
|
|
|
|
pa => ['usd', 'pab'], |
267
|
|
|
|
|
|
|
pe => ['pen'], |
268
|
|
|
|
|
|
|
pf => ['xpf'], |
269
|
|
|
|
|
|
|
pg => ['pgk'], |
270
|
|
|
|
|
|
|
ph => ['php'], |
271
|
|
|
|
|
|
|
pk => ['pkr'], |
272
|
|
|
|
|
|
|
pl => ['pln'], |
273
|
|
|
|
|
|
|
pm => ['eur', 'cad'], |
274
|
|
|
|
|
|
|
pn => ['nzd'], |
275
|
|
|
|
|
|
|
pr => ['usd'], |
276
|
|
|
|
|
|
|
ps => ['ils', 'jod'], |
277
|
|
|
|
|
|
|
pt => ['eur'], |
278
|
|
|
|
|
|
|
pw => ['usd'], |
279
|
|
|
|
|
|
|
py => ['pyg'], |
280
|
|
|
|
|
|
|
qa => ['qar'], |
281
|
|
|
|
|
|
|
re => ['eur'], |
282
|
|
|
|
|
|
|
ro => ['ron'], |
283
|
|
|
|
|
|
|
rs => ['rsd'], |
284
|
|
|
|
|
|
|
ru => ['rub'], |
285
|
|
|
|
|
|
|
rw => ['rwf'], |
286
|
|
|
|
|
|
|
sa => ['sar'], |
287
|
|
|
|
|
|
|
sb => ['sbd'], |
288
|
|
|
|
|
|
|
sc => ['scr'], |
289
|
|
|
|
|
|
|
sd => ['sdg'], |
290
|
|
|
|
|
|
|
se => ['sek'], |
291
|
|
|
|
|
|
|
sg => ['sgd'], |
292
|
|
|
|
|
|
|
sh => ['shp'], |
293
|
|
|
|
|
|
|
si => ['eur'], |
294
|
|
|
|
|
|
|
sj => ['nok'], |
295
|
|
|
|
|
|
|
sk => ['eur'], |
296
|
|
|
|
|
|
|
sl => ['sle'], |
297
|
|
|
|
|
|
|
sm => ['eur'], |
298
|
|
|
|
|
|
|
sn => ['xof'], |
299
|
|
|
|
|
|
|
so => ['sos'], |
300
|
|
|
|
|
|
|
sr => ['srd'], |
301
|
|
|
|
|
|
|
ss => ['ssp'], |
302
|
|
|
|
|
|
|
st => ['std'], |
303
|
|
|
|
|
|
|
sv => ['usd', 'btc'], |
304
|
|
|
|
|
|
|
sx => ['ang'], |
305
|
|
|
|
|
|
|
sy => ['syp'], |
306
|
|
|
|
|
|
|
sz => ['szl'], |
307
|
|
|
|
|
|
|
tc => ['usd'], |
308
|
|
|
|
|
|
|
td => ['xof'], |
309
|
|
|
|
|
|
|
tf => ['eur'], |
310
|
|
|
|
|
|
|
tg => ['xof'], |
311
|
|
|
|
|
|
|
th => ['thb'], |
312
|
|
|
|
|
|
|
tj => ['tjs'], |
313
|
|
|
|
|
|
|
tk => ['nzd'], |
314
|
|
|
|
|
|
|
tl => ['usd'], |
315
|
|
|
|
|
|
|
tm => ['tmt'], |
316
|
|
|
|
|
|
|
tn => ['tnd'], |
317
|
|
|
|
|
|
|
to => ['top'], |
318
|
|
|
|
|
|
|
tr => ['try'], |
319
|
|
|
|
|
|
|
tt => ['ttd'], |
320
|
|
|
|
|
|
|
tv => ['aud'], |
321
|
|
|
|
|
|
|
tw => ['twd'], |
322
|
|
|
|
|
|
|
tz => ['tzs'], |
323
|
|
|
|
|
|
|
ua => ['uah'], |
324
|
|
|
|
|
|
|
ug => ['ugx'], |
325
|
|
|
|
|
|
|
um => ['usd'], |
326
|
|
|
|
|
|
|
us => ['usd'], |
327
|
|
|
|
|
|
|
uy => ['uyu'], |
328
|
|
|
|
|
|
|
uz => ['uzs'], |
329
|
|
|
|
|
|
|
va => ['eur'], |
330
|
|
|
|
|
|
|
vc => ['xcd'], |
331
|
|
|
|
|
|
|
ve => ['ves'], |
332
|
|
|
|
|
|
|
vg => ['usd'], |
333
|
|
|
|
|
|
|
vi => ['usd'], |
334
|
|
|
|
|
|
|
vn => ['vnd'], |
335
|
|
|
|
|
|
|
vu => ['vuv'], |
336
|
|
|
|
|
|
|
wf => ['xpf'], |
337
|
|
|
|
|
|
|
ws => ['wst'], |
338
|
|
|
|
|
|
|
xk => ['eur'], |
339
|
|
|
|
|
|
|
ye => ['yer'], |
340
|
|
|
|
|
|
|
yt => ['eur'], |
341
|
|
|
|
|
|
|
za => ['zar'], |
342
|
|
|
|
|
|
|
zm => ['zmk'] |
343
|
|
|
|
|
|
|
}; |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
sub get_currencies_for_country { |
347
|
12
|
100
|
|
12
|
1
|
13166
|
croak "get_currencies_for_country received no arguments" if (scalar(@_) == 0); |
348
|
11
|
50
|
|
|
|
26
|
croak "get_currencies_for_country received more than one argument" if (scalar(@_) > 1); |
349
|
|
|
|
|
|
|
|
350
|
11
|
|
|
|
|
21
|
my $country = lc($_[0]); |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
# Return shallow copy to avoid mutating $rh_currencies_for_country |
353
|
11
|
100
|
|
|
|
57
|
if (my $rv = $rh_currencies_for_country->{$country}){ |
354
|
10
|
|
|
|
|
52
|
return [@$rv]; |
355
|
|
|
|
|
|
|
} |
356
|
1
|
|
|
|
|
3
|
return; |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
1; # End of Data::MoneyCurrency |
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
__END__ |