Package: libfinance-quote-perl
Version: 1.16-3
Followup-For: Bug #528844
Please apply the upstream patch as this bug makes an important gnucash
feature (fetching currency quotes) un-usable.
The patch (which is against version 1.16) is attached with this email.
-- System Information:
Debian Release: 5.0
APT prefers jaunty-updates
APT policy: (500, 'jaunty-updates'), (500, 'jaunty-security'), (500,
'jaunty-proposed'), (500, 'jaunty-backports'), (500, 'jaunty')
Architecture: i386 (i686)
Kernel: Linux 2.6.28-15-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libfinance-quote-perl depends on:
ii libcrypt-ssleay-perl 0.57-1 Support for https protocol in LWP
ii libhtml-tableextract- 2.10-3 module for extracting the content
ii libwww-perl 5.820-1 WWW client/server library for Perl
ii perl 5.10.0-19ubuntu1.1 Larry Wall's Practical Extraction
libfinance-quote-perl recommends no packages.
libfinance-quote-perl suggests no packages.
-- no debconf information
diff -Naur Finance-Quote-1.16/lib/Finance/Quote.pm Finance-Quote-1.16.fix/lib/Finance/Quote.pm
--- Finance-Quote-1.16/lib/Finance/Quote.pm 2009-04-13 09:15:29.000000000 -0500
+++ Finance-Quote-1.16.fix/lib/Finance/Quote.pm 2009-05-28 09:39:18.000000000 -0500
@@ -35,16 +35,14 @@
use Carp;
use Finance::Quote::UserAgent;
use HTTP::Request::Common;
-use HTML::TableExtract;
+use HTML::TreeBuilder;
use Encode;
use vars qw/@ISA @EXPORT @EXPORT_OK @EXPORT_TAGS
$VERSION $TIMEOUT %MODULES %METHODS $AUTOLOAD
$YAHOO_CURRENCY_URL $USE_EXPERIMENTAL_UA/;
-$YAHOO_CURRENCY_URL = "http://uk.finance.yahoo.com/currency/convert?amt=1&submit=Convert&";
-# If the above URL ever fails, try rewriting this module to use the URL below.
-# $YAHOO_CURRENCY_URL = "http://uk.finance.yahoo.com/q?s=USDCAD%3DX";
+$YAHOO_CURRENCY_URL = "http://uk.finance.yahoo.com/q?s=";
@ISA = qw/Exporter/;
@EXPORT = ();
@@ -241,16 +239,23 @@
my $ua = $this->user_agent;
- my $data = $ua->request(GET "${YAHOO_CURRENCY_URL}from=$from&to=$to")->content;
- my $te = HTML::TableExtract->new( headers => ['Symbol', 'Bid', 'Ask'] );
- $te->parse(decode_utf8($data)); # The web page returns utf8 content which gives
- # a warning when parsing $data in HTML::Parser
+ my $data = $ua->request(GET "${YAHOO_CURRENCY_URL}$from$to%3DX")->content;
+ # The web page returns utf8 content which gives a warning when parsing $data
+ # in HTML::Parser
+ my $tb = HTML::TreeBuilder->new_from_content(decode_utf8($data));
+
+ # Find the <div> with the data
+ my $div = $tb->look_down('id','yfi_quote_summary_data');
+ # Make sure there's a <div> to parse.
+ return undef unless $div;
+
+ # The first <b> should contain the quote
+ my $rate_element=$div->look_down('_tag','b');
+ # Make sure there's a <b> to parse.
+ return undef unless $rate_element;
- # Make sure there's a table to parse.
- return undef unless ($te->tables);
+ my $exchange_rate=$rate_element->as_text;
- my $row = ($te->rows())[0];
- my ($exchange_rate) = $$row[1];
$exchange_rate =~ s/,// ; # solve a bug when conversion rate
# involves thousands. yahoo inserts
# a comma when thousands occur