Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: morten.bjornsvik [...] experian-da.no
Cc:
AdminCc:

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



CC: <morten_bjoernsvik [...] yahoo.no>
Subject: Invalid DST dates produces lots of errors on perl 5.10.0 or higher
Date: Wed, 23 Mar 2011 14:42:51 +0100
To: <bug-Date-Manip [...] rt.cpan.org>
From: Morten Bjørnsvik <morten.bjornsvik [...] experian-da.no>
Hi all I've just moved our app to perl5.12.2 from perl 5.8.9 We work mainly in 'Europe/Oslo' timezone. When DST changes from winter to summer we add 1hour. Then there is a gap where datetime is invalid. '2010032802:20:52' in timezone 'Europe/Oslo' is such a date. This is fine in perl 5.8.9. [mbj@mortenb5 t]$ /opt/perl/bin/perl Date-Manip-622.t # Date::Manip version:6.22 # Current Timezone:Europe/Oslo Use of uninitialized value $y in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1813. Use of uninitialized value $m in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1820. Use of uninitialized value $d in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1820. Use of uninitialized value $h in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1820. Use of uninitialized value $mn in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1820. Use of uninitialized value $s in concatenation (.) or string at /opt/perl/lib/site_perl/5.12.2/Date/Manip/Base.pm line 1820. Use of uninitialized value $beg in string comparison (cmp) at /opt/perl/lib/site_perl/5.12.2/Date/Manip/TZ.pm line 1078. Use of uninitialized value $end in string comparison (cmp) at /opt/perl/lib/site_perl/5.12.2/Date/Manip/TZ.pm line 1080. Use of uninitialized value $year in addition (+) at /opt/perl/lib/site_perl/5.12.2/Date/Manip/TZ.pm line 1081. # '2010032802:20:52' not supported If I run this on a perl 5.8.9 then there is no errors: ( I need to comment out the TZ_base.pm part because it requires perl5.10) mbj@mortenb2:/opt/s3/server/t> /opt/perl/bin/perl ./Date-Manip-622.t # Date::Manip version:6.22 # '2010032802:20:52' not supported use warnings; use strict; use Test::More; use Date::Manip; diag( "Date::Manip version:" . $Date::Manip::VERSION ); $Date::Manip::Backend = 'DM5'; use Date::Manip::TZ; my $tz = new Date::Manip::TZ; diag( "Current Timezone:" . $tz->curr_zone() ); foreach my $dstring ( q(2010032802:20:52) ) { my $t = Date::Manip::ParseDate($dstring); if ( UNIVERSAL::isa($t, q(Date::Manip))) { ok(1,"'$dstring' supported:"); } else { diag("'$dstring' not supported"); } } -- ---------------------------------------------------------------- Morten Bjørnsvik, Experian Decision Analytics AS Sørkedalsveien 10c, Postbox 5275 Majorstua, 0303 Oslo, Norway Mob: +47 92 44 83 02, Dir: +47 21 52 12 65, Fax: +47 21 52 12 51 ----------------------------------------------------------------
First, a note about your example. You have the lines: use Date::Manip; $Date::Manip::Backend = 'DM5'; use Date::Manip::TZ; The second line is ignored. The backend is already loaded by the time the line is executed. If you want to load the version 5 backend, you must use: BEGIN { $Date::Manip::Backend = 'DM5'; } use Date::Manip; as described in the documentation. The output of your script (showing a version of 6.22) confirms that you are NOT using the version 5 backend. Making that change eliminated the errors, but since the version 5 backend doesn't do daylight saving time correctly, the resulting output isn't correct (but that's an expected failure in the version 5 backend). The second issue is that the version 6 backend should not have given the errors it did. I checked, and I missed one of the error checks that should have been performed. I added it in, and it now works as expected (namely that the date you input is now treated as invalid). This fix will be in the next release. Thanks
Subject: [rt.cpan.org #66814] Invalid DST dates produces lots of errors on perl 5.10.0 or higher
Date: Wed, 23 Mar 2011 16:35:36 +0100
To: <bug-Date-Manip [...] rt.cpan.org>
From: Morten Bjørnsvik <morten.bjornsvik [...] experian-da.no>
Hi Sullivan Thanks for the excellent fast response. I added: $Date::Manip::Backend = 'DM5'; to the begin block and it works as an workaround. Is DM6 faster than DM5? Thanks again for responding so quickly. -- MortenB
Actually, version 6 is quite a bit faster than version 5 AND it handles timezones/DST correctly. It does require perl 5.10.0 or higher, but since you've got that, I'd stronly suggest using it.