From: Pronichev A. <dy...@ag...> - 2005-05-03 13:26:38
|
Hi, I would like to add such behavior to my SPOPS::DBI objects: For example a have an SQL table id INT PRIMARY KEY, login CHAR(20), data BLOB I want to have a spops config like this: my $config = { obj => { isa => ['SPOPS::DBI::MySQL'...], class => 'My::SPOPS::User', field => ['login', 'password', 'email',...], serialize => ['password', 'email'], serialize_to => 'data', ... } } and when I call my $obj = My::SPOPS::User->new(); $obj->{password}='..'; $obj->{email}='...'; $obj->save; I want that all fields in 'serialize' key were serialized (by Storable for example) and serialized data were stored in 'data' field of table (from serialize_to config key). And similarly when I fetch() object I would like that 'serialized' object fields were deserialized and I have an access to them like to regular fields. The point is that I am newbie to SPOPS and I would like to do it in best way. I think I have to write a ruleset and create post_fetch_action, pre_save_action to serialize/deserialize data. Thanks. -- WBR dyker Agava Software |