Subject: | Fails to get currency conversion |
Date: | Fri, 15 Dec 2017 08:49:25 +0000 |
To: | bug-Finance-Quote [...] rt.cpan.org |
From: | Andy Newby <andy.newby [...] gmail.com> |
Hi,
Recently I found that my conversions stopped working:
sub get_price {
# only need these here
use Locale::Currency;
use File::Basename;
use Cache::FileCache;
use Finance::Quote;
my ($currency_from,$currency_to,$amount) = @_;
my ($filename) = fileparse($0, '.pl');
my $cache = Cache::FileCache->new({
cache_root => "/srv/www/
steampunkjunkies.net/www/cgi-bin/admin/tmp_cache/.$filename",
default_expires_in => '1 hour',
});
my $quote = Finance::Quote->new();
my $ratio = $cache->get("$currency_from:$currency_to");
$ratio = $quote->currency($currency_from, $currency_to)
unless defined $ratio;
die "sorry, cannot convert from $currency_from to $currency_to\n"
unless defined $ratio;
$cache->set("$currency_from:$currency_to", $ratio);
return $amount * $ratio
}
I get:
sorry, cannot convert from USD to GBP
It used to work fine - so not sure what has changed.
Even this basic example doesn't work:
use Finance::Quote;
my $q = Finance::Quote->new;
my $conversion_rate = $q->currency("AUD","USD");
print "FOO: $conversion_rate \n";
$conversion_rate is empty.
Any ideas?
Cheers
Andy Newby
*Email:* andy@ultranerds.co.uk
*WWW: *http://www.ultranerds.co.uk
*Mobile: * 07769 201 576