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