Skip Menu |

This queue is for tickets about the Finance-Quote CPAN distribution.

Report information
The Basics
Id: 43685
Status: resolved
Priority: 0/
Queue: Finance-Quote

People
Owner: eco [...] ecocode.net
Requestors: jim [...] spillane.com
Cc:
AdminCc:

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



Subject: Possible Bug or, at least, interesting behaviour
Date: Fri, 27 Feb 2009 00:55:58 +0000
To: bug-Finance-Quote [...] rt.cpan.org
From: jim [...] spillane.com
Hi, the following warnings were raised when I used Quote to retrieve exchange rates and commodity prices. I have a feeling that the warnings are raised by the "dividend date" labels, which, of course, don't exist in the case of non-shares. Removing the -w flag also removes the warnings, which is the easy solution for me, but I thought you might be interested in the possible bug. The warnings can also be generated by using exchange rates, such as "EURGBP=X". Cheers Jim Program ======= #!c:/perl/bin/perl -w use strict; use Finance::Quote; print "Content-type:text/html\n\n"; my $quote = Finance::Quote->new(); my $source = 'yahoo_europe'; my $stock = 'CLG09.NYM'; my %data = $quote->fetch($source,$stock); print "$data{$stock,'name'} $data{$stock,'price'}"; Apache Error Log ================ Use of uninitialized value $year in numeric lt (<) at Quote.pm line 640. Use of uninitialized value $month in pattern match (m//) at Quote.pm line 658. Use of uninitialized value $month in sprintf at Quote.pm line 663. Use of uninitialized value $day in sprintf at Quote.pm line 663. Use of uninitialized value $month in sprintf at Quote.pm line 664. Use of uninitialized value $day in sprintf at Quote.pm line 664. Relevant Excerpts from Quote.pm =============================== 638 if (defined $piecesref->{usdate}) { 639 ($month, $day, $year) = ($piecesref->{usdate} =~ /(\w+)\W+(\d+)\W+(\d+)/); 640 $year += 2000 if $year < 100; 640 $year_specified = 1; 640 # printf ("US Date %s: Month %s, Day %d, Year %d\n", $piecesref->{usdate}, $month, $day, $year); 640 } 657 $month = $piecesref->{month} if defined ($piecesref->{month}); 658 $month = $mnames{lc(substr($month,0,3))} if ($month =~ /\D/); 659 $day = $piecesref->{day} if defined ($piecesref->{day}); 660 661 $year-- if (($year_specified == 0) && ($this_month < $month)); 662 663 $inforef->{$symbol, "date"} = sprintf "%02d/%02d/%04d", $month, $day, $year; 664 $inforef->{$symbol, "isodate"} = sprintf "%04d-%02d-%02d", $year, $month, $day; 665 } Platform ====== Windows XP Perl Version ======== This is perl, v5.10.0 built for MSWin32-x86-multi-thread (with 5 registered patches, see perl -V for more detail) Binary build 1004 [287188] provided by ActiveState http://www.ActiveState.com Built Sep 3 2008 13:16:37 -- jim@spillane.com
Subject: Re: [rt.cpan.org #43685] Possible Bug or, at least, interesting behaviour
Date: Mon, 13 Apr 2009 00:15:51 +0200
To: bug-Finance-Quote [...] rt.cpan.org
From: Erik Colson <eco [...] ecocode.net>
On 27 Feb 2009, at 01:56, jim@spillane.com via RT wrote: Show quoted text
> Hi, the following warnings were raised when I used Quote to retrieve > exchange rates and commodity prices. I have a feeling that the > warnings > are raised by the "dividend date" labels, which, of course, don't > exist > in the case of non-shares. Removing the -w flag also removes the > warnings, which is the easy solution for me, but I thought you might > be > interested in the possible bug. The warnings can also be generated by > using exchange rates, such as "EURGBP=X".
Hello Jim, This is a bug, but it is not a bug in Quote.pm but in yahoo_europe.pm. This command: perl -Ilib ./Examples/stockdump.pl 'yahoo_europe' 'CLG09.NYM' outputs following data: $VAR1 = { 'CLG09.NYMdate' => '00/00/2000', 'CLG09.NYMavg_vol' => undef, 'CLG09.NYMdiv_yield' => undef, 'CLG09.NYMnet' => '01/20/2009', 'CLG09.NYMeps' => undef, 'CLG09.NYMyear_range' => undef, 'CLG09.NYMname' => 'Crude Oil Feb 09', 'CLG09.NYMsuccess' => 1, 'CLG09.NYMcap' => undef, 'CLG09.NYMpe' => undef, 'CLG09.NYMlast' => '38.74', 'CLG09.NYMopen' => '38.74', 'CLG09.NYMask' => '0.00', 'CLG09.NYMisodate' => '2000-00-00', 'CLG09.NYMtime' => '00:00', 'CLG09.NYMdiv' => undef, 'CLG09.NYMsymbol' => 'CLG09.NYM', 'CLG09.NYMday_range' => '34.78', 'CLG09.NYMclose' => '0.00', 'CLG09.NYMp_change' => '+2.23', 'CLG09.NYMmethod' => 'yahoo_europe', 'CLG09.NYMvolume' => '+5.76%', 'CLG09.NYMbid' => '0', 'CLG09.NYMcurrency' => undef, 'CLG09.NYMprice' => '38.74' }; As you see, some fields are definitely wrong, which causes errors when data is treated in Quote.pm. If we want yahoo_europe to support Crude Oil data we should implement specific support in yahoo_europe.pm. -- erik
this bug seems to be resolved by solving bug 44245 -- Erik