Subject: | Bug report |
Date: | Fri, 2 Jul 2010 22:39:23 +0800 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Sai kee Wong <saikee [...] gmail.com> |
I discover that, if the 2nd and 3rd argument of the ParseRecur() is
the end of a year, it will result in following error msg:
Can't use an undefined value as an ARRAY reference at /Library/Perl/5.10.0/Date/Manip/Recur.pm line 1505.
In the attached code, if you set the start Date to any YYYYMMDD
other then YYYY1231, it works. Only YYYY1231 results in the error msg.
Thanks in advance.
B.rgds
SK
Error msg
===============
Can't use an undefined value as an ARRAY reference at /Library/Perl/5.10.0/Date/Manip/Recur.pm line 1505.
Code which could reproduce the error:
=====================
#!/usr/bin/perl
# Perl script for generating plot file for a stock
########################
# Author : skwong
# Revision : $Id: 050417b09.pl,v 1.59 2010-03-11 09:49:29+08 skwong Final skwong $
########################
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
########################
# Use modules, etc.
########################
use Getopt::Long; # type 'peldoc Getopt::Long' for details
use Date::Manip; # general date parsing / calcs
Date_Init("TZ=CCT");
use File::Basename;
$OUTPUT_AUTOFLUSH = 1;
$gap = 1;
@recur=("every monday", # once every week
"1st day of every month", # once every month
# "0:1*0:1:0:0:0", # once every month
# "0:1*1:1:0:0:0", # first Monday of every month
"0:2*0:1:0:0:0", # bi-monthly
"0:3*0:1:0:0:0", # quarterly
"0:6*0:1:0:0:0", # twice a year
"0:12*0:1:0:0:0", # annually
"0:24*0:1:0:0:0", # bi-annually
"0:48*0:1:0:0:0", # 4 yearly
);
$startDate = "20091231";
$endDate = "20100702";
print "$gap\n";
print "$startDate\n";
print "$endDate\n";
print "$recur[$gap]\n";
@labelDates=ParseRecur($recur[$gap], $startDate,$startDate,$endDate,);
Platform
========
Mac OS 10.6.4
27" quad core iMac
Darwin qMac.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 i386
perl version
============
This is perl, v5.10.0 built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.