comparing durations

2003-11-09 Thread Jonathan Swartz
I was trying to compare two durations, and came up with some surprises. DB<1> use DateTime; DB<2> $hour = DateTime::Duration->new(hours=>1); DB<3> $minute = DateTime::Duration->new(minutes=>1); # Try comparing $hour and $minute DB<4> print ($hour < $minute) 1 # Wh?? # Try sub

style question about passing durations

2003-11-09 Thread Jonathan Swartz
Say I've got a function that takes a duration. I could 1) require the user to do DateTime::Duration->new(...); 2) take a listref argument containing the params, e.g. [days=>1] and do the creation myself 3) be flexible and take either argument, distinguishing the two by isa() Any advice from other

Re: comparing durations

2003-11-09 Thread Dave Rolsky
On Sat, 8 Nov 2003, Jonathan Swartz wrote: > I was trying to compare two durations, and came up with some surprises. > > DB<1> use DateTime; > > DB<2> $hour = DateTime::Duration->new(hours=>1); > > DB<3> $minute = DateTime::Duration->new(minutes=>1); > > # Try comparing $hour and $minute >

Re: style question about passing durations

2003-11-09 Thread Dave Rolsky
On Sun, 9 Nov 2003, Jonathan Swartz wrote: > Say I've got a function that takes a duration. I could > > 1) require the user to do DateTime::Duration->new(...); > 2) take a listref argument containing the params, e.g. [days=>1] and do the > creation myself > 3) be flexible and take either argument,

DateTime::Format::ICal bug

2003-11-09 Thread Matt Sisk
DateTime::Format::ICal 0.08 is not passing the dog food test and successfully parsing its own results. For example: $DTFI = DateTime::Format::ICal; $r = $DTFI->parse_recurrence(recurrence => 'FREQ=DAILY'); $str = ($DTFI->format_recurrence($r))[0]; print "$str\n"; produces 'RRULE:FREQ=DAIL