[CDBI] Re: Inflating/deflating with Storable
[prev]
[thread]
[next]
[Date index for 2006/02/17]
> I want to store an *arbitrary* Perl data structure in a column of type
> BLOB (random variable-length binary data). This is easy to do by
> serializing/deserializing the data with Storable::freeze/thaw. I would
> like to make the data automatically inflate/deflate with Class::DBI.
>
> The problem is that the output of the freeze() function is simply a
> string, and the output of thaw() can have pretty much any type at all.
> Class::DBI::Relationship::HasA doesn't like this state of affairs since
> it expects a specific class.
I haven't done anything like this, but I can think of two solutions:
1. Define your own relationship class that works just like HasA, except it
doesn't care about the class of the object after inflation. Just copy the
HasA.pm and change what you need to change, or subclass it in some
fashion, if possible. This assumes that the problem is really with
Class::DBI::Relationship::HasA and not Class::DBI itself.
2. Use a container class and inflate to that. The container object would
always be of the same class, and it would contain the actual object of
arbitrary class that you serialized into the blob.
Hope this helps,
Ed
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
|
[CDBI] Re: Inflating/deflating with Storable
Edward J. Sabol 23:02 on 17 Feb 2006
|