Flavio,

> I expected it to work with unbounded span sets.
>
> Would you make a small example that I could test?

That's great news.

   I  think  I  must   apologise.    The   reason   I   thought,
'intersected_spans' wouldn't work on unbounded SpanSets was that
after the following simple test program it seemed to not  return
but calculate forever:

   use DateTime;
   use DateTime::Duration;
   use DateTime::SpanSet;
   use DateTime::Event::Recurrence;

   my $spanset = DateTime::SpanSet->from_set_and_duration(
      set      => DateTime::Event::Recurrence->daily,
      duration => DateTime::Duration->new(hours => 12)
   );

   my $date1 = DateTime->new(
      year  => 2006,
      month => 6,
      day   => 21,
      hour  => 5
   );

   my $date2 = DateTime->new(
      year  => 2006,
      month => 6,
      day   => 22,
      hour  => 5
   );

   my $span = DateTime::Span->from_datetimes(
      start => $date1,
      end   => $date2
   );

   my $result_spanset = $spanset->intersected_spans($span);

   foreach my $sset ($result_spanset->as_list()) {
      print $sset->{set};
   }

Whereas using a bounded Set instead of the  recurrence  returned
the expected result.

   After I had sent the last mail, I disovered  that  my  bigger
application using 'DateTime' seems to  just  calculate  and  not
return anymore as well without using any of the  new  functions,
so I guess, I messed up the installation of  the  packages  from
CVS.

The only new files I downloaded form CVS are:
- Set.pm
- Span.pm
- SpanSet.pm
- _recurrence.pm

I've probably forgotten some, I'll check later.

Reinhold

Reply via email to