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: 16632
Status: resolved
Priority: 0/
Queue: DateTime

People
Owner: Nobody in particular
Requestors: john [...] rimmkaufman.com
Cc:
AdminCc:

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



Subject: Default stringification of DateTime::Infinite types does not format correctly (root cause of install failures)
Using DateTime v0.2901 in Perl v5.8.6 under Genoo Linux 2.6.14. Stringinfying a DateTime::Infinity::Future results in '-0001--01--01T-01:-01:-01' and a DateTime::Infinity::Past results in '-2147483648--2147483648--2147483648T-2147483648:-2147483648:-2147483648'. This also causes the installation to fail since the is() used by tests 17 and 18 in 20infinite.t uses eq to compare the values (did that change between Test::More 0.46 and now?). The install failure may be a separate issue since that section of the tests appears to be intended to do numeric tests. Code to reproduce: use DateTime; my $pos = DateTime::Infinite::Future->new; my $neg = DateTime::Infinite::Past->new; print "$pos\t$neg\n"; This outputs the values I mentioned above. Proposed solution: Add a formatter for the Infinite types which explicitly formats the stringification. This should correct all platforms treatment of inf - package DateTime::Infinte; sub format_datetime { my $self = shift; return $self->{utc_rd_days}; } And include it in the constructors: <snip> tz => DateTime::TimeZone->new( name => 'floating' ), formatter => 'DateTime::Infinite', #add this }, __PACKAGE__; <snip> Also, add tests to handle the numeric verification: ok($pos == $posinf, "infinity (datetime) == infinity (number)"); ok($neg == $neginf, "neg infinity (datetime) == neg infinity (number)"); and change the descriptions on the current tests to indicate they are work on the stringified values.