Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the DateTime CPAN distribution.

Report information
The Basics
Id: 45966
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: kmx [...] volny.cz
Cc:
AdminCc:

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



Subject: test 04epoch.t fails on Win32/strawberry perl
Date: Mon, 11 May 2009 18:40:00 +0200
To: bug-DateTime [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
Hi, DateTime-0.49 fails during tests with the following error: ... t/03components.t ........ ok t/04epoch.t ............. 1/38 The 'hour' parameter (undef) to DateTime::new was an 'undef', which is not one of the allowed types: scalar at D:\tmp\DateTime-0.49\blib\lib/DateTime.pm line 171 DateTime::new(undef, 'hour', undef, 'minute', undef, 'month', 1, 'second', undef, ...) called at D:\tmp\DateTime-0.49\blib\lib/DateTime.pm line 468 DateTime::from_epoch(undef, 'epoch', 'Number::Overloaded=HASH(0xbcf4ac)') called at t/04epoch.t line 140 # Looks like you planned 38 tests but ran 33. # Looks like your test exited with 255 just after 33. t/04epoch.t ............. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 5/38 subtests (less 4 skipped subtests: 29 okay) t/05set.t ............... ok ... Tested with Win32/strawberry perl 5.8.9 and 5.10.0 (the same failure). After some investigation I have found out that it is during testing negative epoch: $time = Number::Overloaded->new(-12345); $dt = DateTime->from_epoch( epoch => $time ); The problem is the "gmtime" call on line 464 in DateTime.pm - gmtime behaves differently on UNIX and Win32 systems. To illustrate the difference try this simple script: --- test.pl --- my ($se,$mi,$ho,$md,$mo,$yr,$wd,$yd,$id) = gmtime(-12345); print "[$se,$mi,$ho,$md,$mo,$yr,$wd,$yd,$id]\n"; --- On UNIX box it returns: [15,34,20,31,11,69,3,364,0] On Win32box it returns (the same for any negative param): [,,,,,,,,] If you look into http://perldoc.perl.org/perlport.html you will find out that "it is only safe to use times between 0 and (2**31)-1". Please consider to handle this issue somehow to make this module smoothly installable on Win32. -- kmx