I'm writing a program that schedules recurring tasks using RFC 2445 recurrences. I'm 
using DateTime::Format::ICal to turn the RFC 2445 strings into meaningful dates that I 
can play with. I have a problem processing weekly recurrences. Can someone tell me if 
I'm not understanding something, or there's a problem with the DateTime::Format::ICal 
module. I have a test script that shows the problem.

-----
#!/usr/bin/perl -w

use DateTime;
use DateTime::Format::ICal;

my $currenttime = DateTime->now(time_zone => 'America/New_York');
print "NOW: ", $currenttime->datetime(), "\n";

my $dtstart_data = "TZID=America/New_York:20031102T080000";
my $dtstart = DateTime::Format::ICal->parse_datetime($dtstart_data);
print "DTSTART: ", $dtstart->datetime(), "\n";

my $rrule_data = "FREQ=MONTHLY;INTERVAL=1;BYDAY=MO";
#my $rrule_data = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO";
#my $rrule_data = "FREQ=WEEKLY;INTERVAL=2;BYDAY=MO";
my $recur_set = DateTime::Format::ICal->parse_recurrence( recurrence => $rrule_data, 
dtstart => $dtstart);

my $dtnextdate = $currenttime->clone();
for (my $i = 1;$i<=5;$i++) {
  $dtnextdate = $recur_set->next( $dtnextdate );
  print "$i: ", $dtnextdate->datetime(), "\n";
}
========
(with my $rrule_data = "FREQ=MONTHLY;INTERVAL=1;BYDAY=MO";)
NOW: 2003-10-31T10:57:38
DTSTART: 2003-11-02T08:00:00
1: 2003-11-03T08:00:00
2: 2003-11-10T08:00:00
3: 2003-11-17T08:00:00
4: 2003-11-24T08:00:00
5: 2003-12-01T08:00:00
========
(with my $rrule_data = "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO";)
NOW: 2003-10-31T10:58:48
DTSTART: 2003-11-02T08:00:00
(hangs here...with CPU at 100%)
========
(with my $rrule_data = "FREQ=WEEKLY;INTERVAL=2;BYDAY=MO";)
NOW: 2003-10-31T11:00:27
DTSTART: 2003-11-02T08:00:00
1: 2003-11-03T08:00:00
2: 2003-11-17T08:00:00
3: 2003-12-01T08:00:00
4: 2003-12-15T08:00:00
5: 2003-12-29T08:00:00
========

Any help is appreciated.

Danny Rappleyea <[EMAIL PROTECTED])
Senior Systems Administrator
etrials Worldwide, Inc.
919-653-3441 (phone)


Reply via email to