Lee ♫ Goddard > Finance-Currency-Convert-Yahoo > Finance::Currency::Convert::Yahoo

Download:
Finance-Currency-Convert-Yahoo-0.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: 0.2   Source  

NAME ^

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

SYNOPSIS ^

        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 ^

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

USE ^

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 ^

None.

REVISIONS ^

Please see the enclosed file CHANGES.

PROBLEMS? ^

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 ^

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

AUTHOR ^

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

COPYRIGHT ^

Copyright (C) Lee Goddard, 2001, 2005, ff. - All Rights Reserved.

This library is free software and may be used only under the same terms as Perl itself.

syntax highlighting: