Skip Menu |

This queue is for tickets about the Finance-Currency-Convert-XE CPAN distribution.

Report information
The Basics
Id: 78433
Status: open
Priority: 0/
Queue: Finance-Currency-Convert-XE

People
Owner: Nobody in particular
Requestors: michael [...] thismetalsky.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug: XE changed their site
Date: Tue, 17 Jul 2012 14:03:00 -0400
To: bug-Finance-Currency-Convert-XE [...] rt.cpan.org
From: Michael <michael [...] thismetalsky.org>
I noticed recently that xe.com changed their site. This patch to your XE.pm (assuming 0.20) works for me. -- Michael Stella | IT Systems Architect | http://www.michaelstella.com/ PGP: 1024D/BC3FF6D4 2BC2 A79B 88D1 218A B32B ED7A 2EC2 1206 BC3F F6D4 .tcA thgirypoC muinnelliM latigiD eht detaloiv tsuj evah uoY

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #78433] AutoReply: bug: XE changed their site
Date: Tue, 17 Jul 2012 14:12:46 -0400
To: Bugs in Finance-Currency-Convert-XE via RT <bug-Finance-Currency-Convert-XE [...] rt.cpan.org>
From: Michael <michael [...] thismetalsky.org>
Right, so here's the patch, since this automated email thing didn't work. --- lib/Finance/Currency/Convert/XE.pm 2012-06-19 09:50:00.000000000 -0400 +++ /usr/lib/perl5/site_perl/5.10.0/Finance/Currency/Convert/XE.pm 2012-07-17 13:58:32.000000000 -0400 @@ -315,22 +315,24 @@ my $tag; my $p = HTML::TokeParser->new(\$html); - # look for the faq link - while(1) { - return unless($tag = $p->get_tag('a')); - last if(defined $tag->[1]{href} && $tag->[1]{href} =~ /faq/); - } - - # jump to the next table - $tag = $p->get_tag('table'); - - # from there look for the target value - while($p->get_token) { - my $text = $p->get_trimmed_text; - - if(my ($value) = $text =~ /([\d\.\,]+) $self->{code}/) { - $value =~ s/,//g; - return sprintf $self->{string}, $value; + # first look for the 'td' element + while (1) { + return unless ($tag = $p->get_tag('td')); + next unless (defined($tag->[1]{'align'}) && ($tag->[1]{'align'} eq 'left')); + # this will probably be the value + my $value = $p->get_trimmed_text; + + # then make sure this has the 'span' with the target + # currency code + my $tag2 = $p->get_tag('span'); + my $cd = $p->get_trimmed_text; + if (defined($tag2) && defined($tag2->[1]{'class'} && $tag2->[1]{class} eq 'uccResCde' +)) { + if ($cd eq $self->{code}) { + # found it, return + $value =~ s/,//g; + return sprintf $self->{string}, $value; + } } }
On Tue Jul 17 14:03:11 2012, michael@thismetalsky.org wrote: Show quoted text
> > I noticed recently that xe.com changed their site. This patch to your
XE.pm Show quoted text
> (assuming 0.20) works for me.
Thank you! I have patched it and released as 0.21.