On Mon, Aug 07, 2006 at 04:47:56AM -0500, Dave Rolsky wrote:
> On Sun, 6 Aug 2006, Bill Moseley wrote:
>
> >In general, instead of:
> >
> > Carp::croak( "Cannot compare a datetime to a regular scalar" )
> > unless ( DateTime::Helpers::can( $dt1, 'utc_rd_values' ) &&
> > DateTime::Helpers::can( $dt2, 'utc_rd_values' ) );
> >
> >How about:
> >
> > Carp::croak( "Cannot compare a datetime to a regular scalar [$dt1]
> > [$dt2" )
> > unless ( DateTime::Helpers::can( $dt1, 'utc_rd_values' ) &&
> > DateTime::Helpers::can( $dt2, 'utc_rd_values' ) );
>
> Something along these lines will be in the next release, which should come
> out some time this week.
Cool. I'm all for verbose error messages.
BTW should DateTime die if both items are not a DateTime objects?
Why I ask is the backtrace led me to this in Template::Stash:
sub _dotop {
my ($self, $root, $item, $args, $lvalue) = @_;
my $rootref = ref $root;
my $atroot = ($root eq $self);
my ($value, @result);
where the test for ($root eq $self) was causing the exception in
DateTime because one object was not a DateTime object.
If they are not both DateTime objects can we state that they are not
equal?
--
Bill Moseley
[EMAIL PROTECTED]