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' ) );

Makes it more fun when I do this in my template:

    my $vars = { now => DateTime->now  };

    $t->process( \*DATA, $vars) || die $t->error;

    __END__
    This is the template
    Formatted mdy = [% now.mdy %]


Then when I get this:


    undef error - Cannot compare a datetime to a regular scalar
    [2006-08-06T15:09:52] [Template::Stash=HASH(0x860fabc)] at 
/usr/lib/perl5/DateTime.pm line 1395, <DATA> line 1.

I can then wander off in a different direction wondering why
_compare is being called in the first place and why the stash is
being passed.  My guess is because of overloading.


-- 
Bill Moseley
[EMAIL PROTECTED]

Reply via email to