2005/7/25, IvorW <[EMAIL PROTECTED]>:
> 
> > From: Flavio S. Glock
> > I think the consensus here was that this kind of application would be
> > better handled by a database.
> 
> Are you talking about doing all the work inside a stored proc?

I mean just a simple table, and some Perl code to initialize it. This
can be very efficient.
 
> I do have a database with the financial centre holiday calendars in it, and I 
> have Class::DBI code hooking to it quite satisfactorily. In my case, I'd 
> prefer to do the work in perl.
> 
> >
> > I started an experimental module called DateTime::Event::Spreadsheet,
> > that can be used to mix recurrences and databases - it should be able
> > to handle this type of queries, if properly configured. You can get it
> > from the project CVS.
> 
> Can you explain what you mean by a recurrence.

A recurrence is a "rule" that you can use to calculate a set of dates
- such as "second sunday of may". See the module
"DateTime::Event::ICal" in CPAN:

  http://search.cpan.org/search?query=datetime-rfc2445

> I presume you didn't upload to CPAN. How do I get to the CVS?

module directory:
http://cvs.sourceforge.net/viewcvs.py/perl-date-time/modules/DateTime-Event-Spreadsheet

module source:
http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-date-time/modules/DateTime-Event-Spreadsheet/lib/DateTime/Event/Spreadsheet.pm
-------------------------
=head1 NAME

DateTime::Event::Spreadsheet - A collection of named DateTime events

=head1 SYNOPSIS

  use DateTime::Event::Spreadsheet;

  $dtes = DateTime::Event::Spreadsheet->new;

  $dtes->set( 
      birthday => DateTime->new( year => 1964 ) 
  );
  print $dtes->get( 'birthday' )->datetime;

  $dtes->set_function( 
      now => sub { DateTime->now } 
  );
  print $dtes->get( 'now' )->datetime;

=head1 DESCRIPTION

DateTime::Event::Spreadsheet is a class for representing 
a collection of DateTime events and the relations between them.

For example, a Spreadsheet could be used to store business
hours information, together with rules for holidays. 
-------------------------

> 
> >
> > I did some experiments with storing recurrence rules in a database,
> > but it ended up being too slow to be useful.
> 
> In my case, I have an existing application and database.

I think the best approach to this problem would be to set up a
"calendar server",
which is a specialized database. There are many options in the
internet - Hula, Sun Calendar Server (Netscape's), Plone, and some
more. I'm not familiar with any of these.
You can probably build your own using the DateTime::Event::* modules.

- Flavio S. Glock

Reply via email to