This serialized columns seem common practice (at least 2-3 devs asked
up till now) but inclusion in RDBO package may be overkill, how about
posting the samples in documentation or in the wiki (I faintly recall
RDBO wiki somewhere)?



2007/6/22, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
> > thanks again for this, svilen.
> >
> > i took what you posted, plus the followups from jsiracusa, and got
> > something going.  your code was very helpful.
> >
> > i made some slight adjustments, notably calling $class->freeze/thaw
> > in the methodmaker, and implementing those as class methods there.
> >
> > that allowed me to do something like:
> >
> >    package My::MethodMaker::Serialized::JSON;
> >    use base 'My::MethodMaker::Serialized';
> >    use JSON;
> >    sub freeze { JSON->new->objToJson($_[1]) }
> >    sub thaw   { JSON->new(skipinvalid => 1)->jsonToObj($_[1]) }
> >    1;
> >
> >    package My::MethodMaker::Serialized::YAML;
> >    use base 'My::MethodMaker::Serialized';
> >    use YAML::Syck();
> >    sub freeze { YAML::Syck::Dump($_[1]) }
> >    sub thaw   { YAML::Syck::Load($_[1]) }
> >    1;
> >
> >    package My::MethodMaker::Serialized::Storable;
> >    use base 'My::MethodMaker::Serialized';
> >    use Storable();
> >    sub freeze { Storable::freeze($_[1]) }
> >    sub thaw   { Storable::thaw($_[1]) }
> >    1;
> >
> > add some little My::Column::Serialized::* wrappers to do the
> > method_maker_class/type bits, plus this in My::MetaData
> >
> >    __PACKAGE__->column_type_class(serialized_storable =>
> > 'Plex::RDBO::_serialized_storable_column');
> >    __PACKAGE__->column_type_class(serialized_yaml =>
> > 'Plex::RDBO::_serialized_yaml_column');
> >    __PACKAGE__->column_type_class(serialized_json =>
> > 'Plex::RDBO::_serialized_json_column');
>
> er,
>
>     __PACKAGE__->column_type_class(serialized_storable =>
>  'My::Column::Serialized::Storable');
>     __PACKAGE__->column_type_class(serialized_yaml =>
>  'My::Column::Serialized::YAML');
>     __PACKAGE__->column_type_class(serialized_json =>
> 'My::Column::Serialized::JSON');
>
> do not fear my crazy actual package names i exposed up there :)
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Rose-db-object mailing list
> Rose-db-object@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rose-db-object
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to