Finance::Currency::Convert::Yahoo - convert currencies using Yahoo


Finance-Currency-Convert-Yahoo documentation  | view source Contained in the Finance-Currency-Convert-Yahoo distribution.

Index


NAME

Top

Finance::Currency::Convert::Yahoo - convert currencies using Yahoo

SYNOPSIS

Top

	use Finance::Currency::Convert::Yahoo;
	$Finance::Currency::Convert::Yahoo::CHAT = 1;
	$_ = Finance::Currency::Convert::Yahoo::convert(1,'USD','GBP');
	print defined($_)? "Is $_\n" : "Error.";
	exit;

	# See the currencies in a dirty way:
	use Finance::Currency::Convert::Yahoo;
	use Data::Dumper;
	warn %Finance::Currency::Convert::Yahoo::currencies;
	exit;

DESCRIPTION

Top

Using Finance.Yahoo.com, converts a sum between two currencies.

USE

Top

Call the module's &convert routine, supplying three arguments: the amount to convert, and the currencies to convert from and to.

Codes are used to identify currencies: you may view them in the values of the %currencies hash, where keys are descriptions of the currencies.

In the event that attempts to convert fail, you will recieve undef in response, with errors going to STDERR, and notes displayed if the modules global $CHAT is defined.

SUBROUTINE convert

	$value = &convert( $amount_to_convert, $from, $to);

Requires the sum to convert, and two symbols to represent the source and target currencies.

In more detail, access http://finance.yahoo.com/d/quotes.csv?s=GBPEUR=X&f=l1, where the value of s (in the example, GBPUSD) is the value of the source and target currencies, and the rest is stuff I've not looked into....

DEPRECATED SUBROUTINE deprecated_convert

The old convert routine: accesses http://finance.yahoo.com/m5?a=amount&s=start&t=to, where start is the currency being converted, to is the target currency, and amount is the amount being converted. The latter is a number; the former two codes defined in our %currencies hash. (For the date this was last checked, print $DATE).

EXPORTS

Top

None.

REVISIONS

Top

Please see the enclosed file CHANGES.

PROBLEMS?

Top

If this doesn't work, Yahoo have probably changed their URI or HTML format. Let me know and I'll fix the code. Or by all means send a patch. Please don't just post a bad review on CPAN, I don't get CC'd them.

SEE ALSO

Top

LWP::UserAgent: HTTP::Request; http://www.macosxhints.com/article.php?story=20050622055810252; http://www.gummy-stuff.org/Yahoo-data.htm.

AUTHOR

Top

Lee Goddard, lgoddard -at- cpan -dot- org.

COPYRIGHT

Top


Finance-Currency-Convert-Yahoo documentation  | view source Contained in the Finance-Currency-Convert-Yahoo distribution.