>From: "Nilson Santos Figueiredo Junior" <[EMAIL PROTECTED]>
>Date: Fri, 15 Sep 2006 20:46:49 -0300
>
>On 9/15/06, Matt S Trout <[EMAIL PROTECTED]> wrote:
> > I think what I'd like to see is a general serialization interface that
>plugins
> > can be written for. Something like
> >
>
>Looks good. The main problem I think is how to properly serialize
>everything (e.g. DateTime objects). Also, how'd you restrict what
>fields would be serialized or not?
If the field already has inflate/deflate, why not deflate it before storage
in the serialized construct? So the DateTime object attached to your $foo
will become the terse database value instead of page after page of DateTime
dump. And when de-serialized, it runs all fields of the class through any
available inflators.
Or, if another set of 'flators could be specified for a field, would it be
possible to build a Javascript Date object into the JSON construct, for
example? Some way to put in a javascript eval literal "new Date(
".join(',', map $dt->$_, qw( year month day hours minute second millisecond
) )." ); "; # ... or something.
Hrmm, well maybe it is easier to keep the terse deflated value in the JSON
thing, and in your Javascript application you could write functions to throw
your objects through that inflate them back into Javascript objects of other
types.
But then you've got to do JS pattern matches and it could be easier when you
start with the inflated object on the perl side.
Mark
_________________________________________________________________
Add fun gadgets and colorful themes to express yourself on Windows Live
Spaces
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://www.get.live.com/spaces/features
_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/