NAME
Finance::Currency::Convert::DnB - convert currencies with up to date currencies from dnbnor.no
SYNOPSIS
use Finance::Currency::Convert::DnB;
#get results with default number of decimals which is 2
$result = currency 20, "NOK", "GBP";
#3 decimals
$result = currency 20, "NOK", "GBP", 3;
#convert several numbers
$result = currency \@values, "NOK", "GBP";
$result = currency [20, 50, 35], "NOK", "GBP";
#store all results in a hash
my %all_currencies = currency 20, "NOK";
print "20 NOK in $_ is $all_currencies{$_}\n" foreach (keys %all_currencies);
#get a list of available currencies
my @currencies = currencies;
DESCRIPTION
Finance::Currency::Convert::DnB uses a XML list from dnbnor.no to convert currencies. Caches XML list in a temporary file for quick access.
AVAILABLE METHODS
currency
$result = convert 20, "NOK", "GBP", 2;
Amount can also be an array reference, and it will return a total of all elements.
If conversion currency is excluded, it will return a hash with all results for all currencies.
If number of decimals is excluded, if will default to 2 decimals.
currencies
Returns a list of available currencies sorted alphabetically.
update_currency
This is an internal function called automatically to update currencies. It is done automatically if the cache is non-existing or if it is older than 12 hours. You can force updating by calling it with a true argument.