DateTime::Duration compare

2003-04-04 Thread fglock
I noticed DateTime::Duration <=> is not checking the 'reverse' flag. Also, it would be useful to be able to compare a duration to zero, in order to check if it is negative, positive or null. I could do that, just tell me if it is ok. - Flavio S. Glock

Re: DateTime::Duration compare

2003-04-04 Thread Dave Rolsky
On Fri, 4 Apr 2003 [EMAIL PROTECTED] wrote: > I noticed DateTime::Duration <=> is not > checking the 'reverse' flag. > > Also, it would be useful to be able to > compare a duration to zero, in order to check if > it is negative, positive or null. > > I could do that, just tell me if it is ok. Sou

Re: DateTime::Duration compare

2003-04-04 Thread Dave Rolsky
On Fri, 4 Apr 2003 [EMAIL PROTECTED] wrote: > I noticed DateTime::Duration <=> is not > checking the 'reverse' flag. > > Also, it would be useful to be able to > compare a duration to zero, in order to check if > it is negative, positive or null. > > I could do that, just tell me if it is ok. Act

Re: DateTime::Duration compare

2003-04-04 Thread Dave Rolsky
On Fri, 4 Apr 2003, Dave Rolsky wrote: > > Also, it would be useful to be able to > > compare a duration to zero, in order to check if > > it is negative, positive or null. Ugh, I must take a moment before replying to mail. I thought about this a bit more and realized I don't really like it, bec

Re: DateTime::Duration compare

2003-04-05 Thread fglock
Dave Rolsky wrote: > I thought about this a > bit more and realized I don't really like it, because it special cases one > number, zero. But comparing it to other numbers wouldn't make sense. Ok. Maybe a $dt_dur->is_zero() method instead? - Flavio S. Glock

Re: RFC: DateTime::Duration::Compare

2003-06-28 Thread Dave Rolsky
On Sat, 28 Jun 2003, Rick Measham wrote: > This is just for comment. As per my previous email, this module allows > one to compare durations when given a reference point. I'm not real > happy with the method names, and I've just called it > DateTime::Duration::Comp

Template Toolkit and DateTime::Duration->compare()

2004-12-08 Thread Arshavir Grigorian
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

Re: Template Toolkit and DateTime::Duration->compare()

2004-12-08 Thread fglock
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-&g

Re: Template Toolkit and DateTime::Duration->compare()

2004-12-09 Thread Arshavir Grigorian
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

Re: Template Toolkit and DateTime::Duration->compare()

2004-12-09 Thread Dave Rolsky
On Wed, 8 Dec 2004, Arshavir Grigorian wrote: 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. This seems like it could be a general problem with TT. I wonder why it's usi

Re: Template Toolkit and DateTime::Duration->compare()

2004-12-09 Thread Dave Rolsky
On Thu, 9 Dec 2004, Arshavir Grigorian wrote: - my $atroot = ($root eq $self); + my $atroot = ((ref ($root) eq ref ($self)) && ($root eq $self)); Even better would be something like this: use Scalar::Util qw(refaddr); my $atroot = ref $root && refaddr($root) == refaddr($self); By "overload aware"

Re: Template Toolkit and DateTime::Duration->compare()

2004-12-09 Thread Arshavir Grigorian
Dave Rolsky wrote: On Wed, 8 Dec 2004, Arshavir Grigorian wrote: 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. This seems like it could be a general problem with TT. I

DateTime::Duration->compare() return value is not specified in the documentation.

2013-10-10 Thread Andreas Isberg
Hi, The documentation does not specify what What does DateTime::Duration->compare() returns. >From some testing I've done it seems like it - 1 if the first duration is larger than the second, - 0 if the durations are equal - -1 is the second duration is larger than the

Re: DateTime::Duration->compare() return value is not specified in the documentation.

2013-10-10 Thread Rick Measham
Hi Andreas, It does need to be documented, but to explain: $dt->compare follows the behavior of `cmp` and ``. - Rick On Thu, 10 Oct 2013 10:07:02 +0200, Andreas Isberg wrote: > Hi, > The documentation does not specify what What does DateTime::Duration->compare() returns.