This is something in between an RFC and an ANNOUNCE -
maybe I went too far in the development before discussing it here.

This small module provides a structure that can store DateTimes 
with attributes (as discussed many times here), but it can do 
a lot more than that.


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

DOWNLOAD - Single executable file with module + pod + examples + tests:

 
http://www.ipct.pucrs.br/flavio/perl/DateTime-Event-Spreadsheet-0.0_2.pl

SYNOPSIS

  use DateTime::Event::Spreadsheet;

  $dtes = DateTime::Event::Spreadsheet->new;
  $dtes->set( 'birthday',
      value => DateTime->new( year => 1964 ) 
  );
  print $dtes->cell( 'birthday' )->datetime;

DESCRIPTION

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

For example, a Spreadsheet could be used to store business
hours information, together with holidays. A cell could be
tied to a database value, and other cells would be automatically
updated when that value changes.

Each event or function is stored in a Spreadsheet cell.
All cells have names (or keys), such as "A1", "B10", or "birthday".

A Spreadsheet may contain any combination of 
DateTime::* objects, including DateTime::Event::*, 
DateTime::Set, DateTime::Span, DateTime::SpanSet,
other Spreadsheets, and Perl subroutines.

USAGE - Methods

* new
This is the Spreadsheet constructor.
It takes no parameters.

* set
    $dtes->set( 'now', 
        value => DateTime->now 
    );

Sets a cell contents.
A unique key must be provided.
Setting the same key again will overwrite the previous contents.

A cell may contain any type of DateTime::* objects, or
a Perl subroutine reference.
Exceptions are handled by the object into the cell.

This is an example of how to put a Perl subroutine in a cell:

    $dtes->set( 'now',
        value => sub { DateTime->now }
    );

A parameter list may be specified, containing cell names.
The cell values are provided through @_ at run time:

    $dtes->set( 'later',
        param => [ 'now' ],
        value => sub { $_[0]->add( hours => 1 ) }
    );

* cell
    my $value = $dtes->cell( 'now' );
    print $value->datetime;

Returns the cell value. 

If the cell contains a function,
cell() will evaluate the function and return the result.

---

- Flavio S. Glock

Reply via email to