pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/44623: fix bug in p5-Finance-Quote-1.17nb1



>Number:         44623
>Category:       pkg
>Synopsis:       fix bug in p5-Finance-Quote-1.17nb1
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 22 18:35:00 +0000 2011
>Originator:     Marko Schuetz Schmuck
>Release:        NetBSD/amd64 5.0.2
>Organization:
individual
>Environment:
NetBSD prpad.dyndns.org 5.0.2 NetBSD 5.0.2 (PRPAD) #0: Mon May  3 15:16:09 AST 
2010  root%prpad.dyndns.org@localhost:/usr/obj/sys/arch/amd64/compile/PRPAD 
amd64

>Description:
One of the sources for online quotes, VWD, has changed page structure. This 
made the source unusable for GnuCash. The attached patch fixes this. I have 
also submitted a patch upstream, but noticed that similar patches have been 
open in their tracker for many months.
>How-To-Repeat:
sudo pkg_add gnucash
gnc-fq-dump vwd 687480
# notice message about information not usable in GnuCash
>Fix:
cd /usr/pkgsrc/finance/p5-Finance-Quote
#store the following patch into patches/patch-aa
#bump PKGVERSION
make makepatchsum
make update


$NetBSD$

--- lib/Finance/Quote/VWD.pm.orig       2009-10-05 13:39:57.000000000 -0400
+++ lib/Finance/Quote/VWD.pm
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -W
+#!/usr/pkg/bin/perl -W
 #
 #    Copyright (C) 1998, Dj Padzensky <djpadz%padz.net@localhost>
 #    Copyright (C) 1998, 1999 Linas Vepstas <linas%linas.org@localhost>
@@ -123,7 +123,10 @@ sub vwd
       next if not $content;
 
       # <h1> contains price, time, name, and symbol
-      my $head = $content->find("h1");
+      my $head = $content->look_down(
+        "_tag", "div",
+        "class", "wpHeadline"
+      );
       next if not $head;
 
       my $wpkurs = $head->look_down(
@@ -148,21 +151,24 @@ sub vwd
          $_->delete;
       }
 
-      if ($head->as_trimmed_text =~ /^(.*) \((.+)\)$/) {
-         $info{$fund, "name"} = $1;
-         $info{$fund, "symbol"} = $2;
+      my $wpsymbol = $content->look_down(
+         "_tag", "ul",
+         "class", "wpInfo"
+      );
+      if ($wpsymbol) {
+         my @li = $wpsymbol->find("li");
+         if ($li[4]->as_text =~ /WKN:(\w+)/) {
+            $info{$fund, "symbol"} = $1;
+         }
       }
 
       # <ul> contains currency as 3rd <li>
       my $wpinfo = $content->look_down(
-         "_tag", "ul",
-         "class", "wpInfo"
+         "_tag", "span",
+         "class", "whrg"
       );
       if ($wpinfo) {
-         my @li = $wpinfo->find("li");
-         if ($li[2]->as_text =~ /Währung:(\w+)/) {
-            $info{$fund, "currency"} = substr($1, 0, 3);
-         }
+         $info{$fund, "currency"} = substr($wpinfo->as_text, 0, 3);
       }
 
       # fund ok



Home | Main Index | Thread Index | Old Index