Hello,
I am running into a snag with using DateTime::Duration and TT. I think it's an important issue and am surprised that there is no info on this on Google.
Somehow when you try to invoke any of DateTime::Duration's accessor methods from within a TT template it dies with an error that comparison operators are not overloaded in DateTime::Duration and that I should use DateTime::Duration->compare() to do comparisons.
I have tracked this down and it appears that somewhere deep in the template processing, TT is doing an 'eq' on a DateTime::Duration object and that's throwing an exception.
I am wondering whether it would be very hard to overload the comparison operators.
If both objects are of DateTime::Duration, then can you just call compare from within _compare_overload(). And if they are not of the same type, then they are obviously not equal.
Or maybe the 'eq' operator could be a special case of comparison, implemented as a separate _eq_overload() subroutine.
Maybe, I am asking for too much, but it seems like what I am trying to do is fairly mundane.
Thanks for any insights you may have.
Arshavir