Subject: | Bad interaction with Template-Toolkit |
The minimal testcase below demonstrates a failure when a DateTime
instance method is used inside of a Template-Toolkit document. The
problem is that Template::Stash does an 'eq' comparison of it's stash
hash against every dotted operand. Due to overload, this invokes
DateTime::_compare, which croaks.
I'm not sure whose fault this is because I upgraded my Template-Toolkit
from v2.15 to v2.18 on the same day that I upgraded DateTime...
However, it seems to me that DateTime is being excessively strict. My
opinion is that _compare should return false instead of croaking if one
object is not a DateTime instance.
Chris
#!/usr/bin/perl -w
use strict;
use DateTime 0.37;
use Template 2.18;
Template->new->process(\*DATA, {dt => DateTime->now})
|| die Template->error;
__DATA__
[% dt.year %]