Subject: | $delta->set('d', 1); does not work |
Executing the following script produces an error message.
Script:
--
my $delta = new Date::Manip::Delta;
$delta->set('d', 1);
--
Error message:
--
Can't use string ("1") as an ARRAY ref while "strict refs" in use at
/usr/local/lib/perl5/site_perl/5.10.1/Date/Manip/Delta.pm line 136.
at /usr/local/lib/perl5/site_perl/5.10.1/Date/Manip/Delta.pm line 136
Date::Manip::Delta::set('Date::Manip::Delta=HASH(0xa3d7888)',
'd', 1) called at test.pl line 24
--
The reason may be that $val is treated both as a scalar and as an array
reference in Date::Manip::Delta::set.
I attached a patch to fix this bug.
Thanks in advance.
Subject: | Date-Manip-6.11.diff |
diff -Naru Date-Manip-6.11.orig/lib/Date/Manip/Delta.pm Date-Manip-6.11/lib/Date/Manip/Delta.pm
--- Date-Manip-6.11.orig/lib/Date/Manip/Delta.pm 2010-05-01 03:09:24.000000000 +0900
+++ Date-Manip-6.11/lib/Date/Manip/Delta.pm 2010-07-05 14:08:54.359375000 +0900
@@ -131,9 +131,9 @@
$delta[$f{$field}] = $val;
if ($business) {
- ($err,@delta) = $dmb->_normalize_business(0,@$val);
+ ($err,@delta) = $dmb->_normalize_business(0,@delta);
} else {
- ($err,@delta) = $dmb->_normalize_delta(0,@$val);
+ ($err,@delta) = $dmb->_normalize_delta(0,@delta);
}
}