NAME

Finance::Currency::Convert::Custom - Update for Finance::Currency::Convert with ability of own rates updating on the fly.

SYNOPSIS

  use Finance::Currency::Convert::Custom;
  use LWP::UserAgent;
  my @currencies = ('EUR','GBP','AUD','CAD','BRL','DKK','HKD','KRW','NOK','SEK','CHF','TWD');
  my $converter = new Finance::Currency::Convert::Custom;
  foreach my $currency (@currencies){	
  	#also, updateRates has same call, you should add ref to your sub as first param - others like in Finance::Currency::Convert
  	#also, if ref to sub is not defined then own internal example is used
	  $converter->updateRate(\&own_fetch_rate,$currency, "USD");
	  my $rate = $converter->convert(1, $currency, "USD"); 	  	  
  }
  
  sub own_fetch_rate{
  	my ($cur_from, $cur_to) = @_;
	my $browser = LWP::UserAgent->new;
	my $response = $browser->get( "http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s=".$cur_from.$cur_to."=X" );
	my $data = $response->content();
	my @arr = split /,/,$data; 
	return $arr[1];
  }
  
  

DESCRIPTION

Finance::Currency::Convert::Custom should be useful for people, who needs to have own rates or have own methods for fetching them, but who likes Finance::Currency::Convert. Its needed because of Finance::Currency::Convert strong dependency of Finance::Quote. The last module fails a lot last time.

SEE ALSO

Finance::Currency::Convert::Custom

AUTHOR

Dmitry Nikolayev <dmitry@cpan.org>, http://makeperl.com

THANKS

Thanks to Freecause, http://freecause.com for giving opportunity to make same for company and community ;)

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Dmitry Nikolayev

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.