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

People
Owner: Nobody in particular
Requestors: corion [...] corion.net
Cc:
AdminCc:

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



Date: Mon, 28 Feb 2005 22:38:05 +0100
From: Max Maischein <corion [...] corion.net>
To: bug-DateTime [...] rt.cpan.org
Subject: (wishlist) DateTime 0.28 has bad error diagnostics for comparing uncomparable items
While tracing some bad interaction with Template, I was annoyed by the bad error diagnostics that DateTime has - it dies with an unhelpful message instead of telling at least the values when a comparison happens between one DateTime object and a second object. The following program shows the ugly behaviour: use DateTime; DateTime->now < 1 DateTime gives an error location within itself, which doesn't help much, and the diagnostic is bad, as it doesn't even tell I<what> values it tried to compare. The below patch is what I changed - one thing is to use Carp.pm, and the other is to output the values in the scalar or whatever DateTime was offended by. That way, one gets at least an indication of where the error occurred. -max 3a4 Show quoted text
> use Carp qw(croak);
1385c1386 < die "Cannot compare a datetime to a regular scalar" --- Show quoted text
> croak "Cannot compare a datetime to a regular scalar ($dt1 /$dt2)"
Sorry for the slow response. I've changed a number of die()s to croak() for 0.31.