Hi there.

My name is Sam Vilain, I've been programming Perl for about 3 years and
now it's time for me to start putting things back.  

The first module I'm going to contribute is called Class::Tangram, which
acts as a base class for Tangram persistent objects.  You place the
section of the Tangram schema particular to each object within the package
scope as $Object::schema, run Class::Tangram::import_schema("Object"), and
then you get:

   - Object->new(field => value) style constructor
   - $o->set_field(value) field updating methods (implemented via
     AUTOLOAD)
   - $o->get_field() accessors (also aliased as $o->field())
   - $o->clear_refs, which explicitly breaks any references in attributes,
     empties Set::Object containers, etc.

The set_field method performs simple type checking, so eg you can't set an
int to a string, or a "ref" to a non-blessed object.

It also extends the tangram schema specification by allowing you to
specify, for each attribute, a "check_func" (a CODE ref that is called
with the argument as first parameter and dies if there is a problem)
and an "init_default" (either a basic data type that is used as a default
or a code ref returing the default).

In this respect, it is somewhat similar to Class::Contract, but you get
the ability to store the objects in an RDBMS via Tangram instantly.  In
fact, I will eventually try to roll support for this into Class::Contract.

I would like to use the PAUSE id of SAMV.

Cheers,
--
   Sam Vilain, [EMAIL PROTECTED]     WWW: http://sam.vilain.net/
    7D74 2A09 B2D3 C30F F78E      GPG: http://sam.vilain.net/sam.asc
    278A A425 30A9 05B5 2F13

Hi, I'm a .signature virus!  Copy me into your ~/.signature, please!

PGP signature

Reply via email to