Skip Menu |

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

Report information
The Basics
Id: 21628
Status: resolved
Priority: 0/
Queue: Finance-QuoteHist

People
Owner: MSISK [...] cpan.org
Requestors: jcalkins [...] swcp.com
Cc:
AdminCc:

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



Subject: splits method shows only last digit of Post value
ActivePerl 5.8.7, build 815 on Win XP SP 2 When you run this command line: perl -MFinance::QuoteHist -e "print qq(\nSymbol\tDate\t\tPost\tPre\n); while ( ($Symbol, $date) = (shift, shift) and defined $date ) { $q = Finance::QuoteHist->new(symbols => [$Symbol], start_date => $date, end_date => $date, lineup => 'Finance::QuoteHist::Yahoo' ); foreach $ra_row ($q->splits()) { local ($,,$\) = (qq(\t),qq(\n)); print @$ra_row; }}" NPBC 2006-09-06 TKC 2006-06-26 EPIX 2006-08-17 ID 2005-12-19 RBNC 2005-11-02 You get this output (I added the [s/b] column to show the correct Post numbers): Symbol Date Post [s/b] Pre NPBC 2006/09/06 3 103 100 TKC 2006/06/26 5 85 16 EPIX 2006/08/17 0 10 15 ID 2005/12/19 0 10 25 RBNC 2005/11/02 1 11 10 Suggested patch (and please forgive me if I over-explained--I've no way of knowing how much or how little to say): Replace "my($date, $post, $pre) = /^(\S+).*(\d+):(\d+)/;" With one of the following, from fastest, but least resistant to format changes to slowest, but most likely to survive small niggling format changes like changing [ to " or using leading hyphens or designator letters or other things bored Yahoo programmers may do in the dark of the night: my($date, $post, $pre) = /^(\S+)\s*\[(\d+):(\d+)/m; <-- least robust, fastest my($date, $post, $pre) = /^(\S+)\D*(\d+):(\d+)/m; my($date, $post, $pre) = /^(\S+).*?\b(\d+):(\d+)/m; my($date, $post, $pre) = /^(\S+).*\b(\d+):(\d+)/m; my($date, $post, $pre) = /^(\S+).*\D(\d+):(\d+)/m; <-- most robust, most processing All of these test okay with the symbol/date samples above. The second regex is the best, as long as Yahoo never sticks any digits between the date and the split Post value. The third and fourth ones would survive that and just about any format changes that don't put word characters on front of the Post value. The last one would survive even word characters prepended to the Post value. Good luck, mate, and thanks for the great module. This thing is saving my life.
This particular problem has been fixed for quite some time, apologies for leaving the ticket open for so long.