[Dbix-class] Storable freeze/thaw on a column?

Mike Friedman friedo at friedo.com
Sun Nov 26 21:31:20 GMT 2006


On 11/26/06, Ash Berlin <ash at cpan.org> wrote:

> InflateColumn is for going to/from an object for a given column. I.e.
> turn datetime column into a DateTime object on read, and from DateTime
> object to datetime column (str value) on write.



Ah, OK. That makes sense.

However for blobs I was under the impression that it would Just Work.
> i.e. you'd get a scalar value with your data in.



Unfortunately, I wasn't able to get it to Just Work; passing a reference to
a blob column mutator just causes the stringification to be stored in the
column. But after looking at the docs for InflateColumn, I was able to get
this to work:

use Storable qw(freeze thaw);

__PACKAGE__->inflate_column(
    myblobcol =3D> {
        inflate   =3D> sub { thaw( shift ) },
        deflate   =3D> sub { freeze( shift ) }
    }
);


Most excellent!

Thanks,


Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20061126/75b=
63810/attachment.htm


More information about the Dbix-class mailing list