Skip Menu |

This queue is for tickets about the Date-Manip CPAN distribution.

Report information
The Basics
Id: 101570
Status: resolved
Priority: 0/
Queue: Date-Manip

People
Owner: Nobody in particular
Requestors: Duncan.Garland [...] motortrak.com
Cc:
AdminCc:

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



Subject: This is going to make upgrading difficult!
Date: Fri, 16 Jan 2015 11:33:06 +0000
To: bug-Date-Manip [...] rt.cpan.org
From: Duncan Garland <duncan.garland [...] motortrak.com>
Hi, You appear to have reversed the order of the arguments to DateCalc at some point. I assume there's something buried in the change logs. Would it be possible to put a note in a more prominent position. Sample script: motrak@mydash-qa:~ $ cat tmp.pl use strict; use warnings; use DateTime; use Date::Manip; use Data::Dumper; my $today = DateTime->today; my $err; my ( $years, $months, undef, undef, undef, undef, undef ) = split( ':', DateCalc( ParseDate($today.""), "01 Feb 2014", \$err, 1 )); print Dumper ( $years, $months, undef, undef, undef, undef, undef ); You have new mail in /var/mail/motrak motrak@mydash-qa:~ $ With an old version of Date::Manip: motrak@mydash-qa:~ $ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi (with 56 registered patches, see perl -V for more detail) Copyright 1987-2011, 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. motrak@mydash-qa:~ $ perl -M"Date::Manip 999999" -e 1 Date::Manip version 999999 required--this is only version 6.25. BEGIN failed--compilation aborted. motrak@mydash-qa:~ $ motrak@mydash-qa:~ $ perl tmp.pl $VAR1 = '-0'; $VAR2 = '11'; $VAR3 = undef; $VAR4 = undef; $VAR5 = undef; $VAR6 = undef; $VAR7 = undef; motrak@mydash-qa:~ $ With a newer version of Date::Manip: motrak@upde-duncang:~$ perl -v This is perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi (with 56 registered patches, see perl -V for more detail) Copyright 1987-2011, 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. motrak@upde-duncang:~$ perl -M"Date::Manip 999999" -e 1 Date::Manip version 999999 required--this is only version 6.47. BEGIN failed--compilation aborted. motrak@upde-duncang:~$ motrak@upde-duncang:~$ perl tmp.pl $VAR1 = '0'; $VAR2 = '-11'; $VAR3 = undef; $VAR4 = undef; $VAR5 = undef; $VAR6 = undef; $VAR7 = undef; motrak@upde-duncang:~$ Regards Duncan -- The information contained in this message is for the intended addressee only and may contain confidential and/or privileged information. If you are not the intended addressee, please delete this message and notify the sender; do not copy or distribute this message or disclose its contents to anyone. Any views or opinions expressed in this message are those of the author and do not necessarily represent those of Motortrak Limited or of any of its associated companies. No reliance may be placed on this message without written confirmation from an authorised representative of the company. Registered in England 3098391 V.A.T. Registered No. 667463890
I have not reversed the order of the arguments to DateCalc ever. The problem is that you are not analyzing the delta the way you should. In your example, you are using split to examine the individual parts of a delta, but that isn't a legitimate way to use a delta. For example, the two different deltas (from two different versions of Date::Manip) work out to be something like: -0:11:0:4:7:52:3 (old version) 0:-11:0:4:7:52:3 (newversion) The delta is the same, though the format (i.e. where the signs go) is a bit different. The reasoning behind this was that some deltas are mixed sign (i.e. part of it may be positive and some negative) though that isn't the case here, and it made them a bit cleaner by keeping the sign 'closer' to the actual non-zero part of the delta. Regardless, you can't (or shouldn't) use split to analyze them... you have to use Delta_Format extract the information you need from a delta, and if you do that, the information should be identical. Splitting the old delta above gives: (-0, 11, 0, 4, 7, 52, 3) which isn't going to help you unless you keep track of all of the signs yourself, because the REAL values (of both the old AND the new delta) are: (-0, -11, -0, -4, -7, -52, -3) So unless you're going to parse it all yourself (i.e. duplicate the functionality that is included as part of Delta_Format), you're not going to get the correct value of the delta. Good luck
Subject: Re: [rt.cpan.org #101570] This is going to make upgrading difficult!
Date: Fri, 16 Jan 2015 13:42:54 +0000
To: bug-Date-Manip [...] rt.cpan.org
From: Duncan Garland <duncan.garland [...] motortrak.com>
The correct answer is 11. So it looks like we've had the arguments the wrong way around all these years and it's only just shown up. Oops! print Dumper Delta_Format( DateCalc( '1 Feb 2014', ParseDate( $today . "" ), \$err, 1 ), 2, ('%Mv') ); motrak@upde-duncang:~$ perl tmp.pl $VAR1 = '11'; Thank for your help. On Fri, Jan 16, 2015 at 1:01 PM, Sullivan Beck via RT < bug-Date-Manip@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=101570 > > > I have not reversed the order of the arguments to DateCalc ever. The > problem is that you are not analyzing the delta the way you should. > > In your example, you are using split to examine the individual parts of a > delta, but that isn't a legitimate way to use a delta. > > For example, the two different deltas (from two different versions of > Date::Manip) work out to be something like: > > -0:11:0:4:7:52:3 (old version) > 0:-11:0:4:7:52:3 (newversion) > > The delta is the same, though the format (i.e. where the signs go) is a > bit different. > > The reasoning behind this was that some deltas are mixed sign (i.e. part > of it may be positive and some negative) though that isn't the case here, > and it made them a bit cleaner by keeping the sign 'closer' to the actual > non-zero part of the delta. > > Regardless, you can't (or shouldn't) use split to analyze them... you have > to use Delta_Format extract the information you need from a delta, and if > you do that, the information should be identical. > > Splitting the old delta above gives: > > (-0, 11, 0, 4, 7, 52, 3) > > which isn't going to help you unless you keep track of all of the signs > yourself, because the REAL values (of both the old AND the new delta) are: > > (-0, -11, -0, -4, -7, -52, -3) > > So unless you're going to parse it all yourself (i.e. duplicate the > functionality that is included as part of Delta_Format), you're not going > to get the correct value of the delta. > > Good luck > > >
-- The information contained in this message is for the intended addressee only and may contain confidential and/or privileged information. If you are not the intended addressee, please delete this message and notify the sender; do not copy or distribute this message or disclose its contents to anyone. Any views or opinions expressed in this message are those of the author and do not necessarily represent those of Motortrak Limited or of any of its associated companies. No reliance may be placed on this message without written confirmation from an authorised representative of the company. Registered in England 3098391 V.A.T. Registered No. 667463890