[Dbix-class] serializing DBIx::Class::ResultSourceHandle
Ash Berlin
ash_cpan at firemirror.com
Thu Sep 20 08:42:05 GMT 2007
Bernhard Graf wrote:
> I have a problem when a Row obect goes through a session:
>
> At the beginning I create a Row object (from Catalyst app) with
>
> $data = $c->model($TABLE)->new_result({...});
>
> $data is filled from forms of the following pages. To make it
> persistent, $data is stored into the session.
>
> Finally I want to
>
> $data->insert
>
> but I get:
>
> Can't call method "source" on an undefined value at
> /usr/lib/perl5/vendor_perl/5.8.5/DBIx/Class/ResultSourceHandle.pm
> line 62
>
> It turns out the schema property of DBIx::Class::ResultSourceHandle is
> deleted before it is serialized.
>
> It seems I have to restore the schema manually into the object before I
> ->insert().
> Is that correct?
> If yes - how to?
>
I wrote the ResultSourceHandle stuff, and I never could come up with a
good way of specifying what schema to use in thawing the data. So
currently you'd have to do
$data->_source_handle->schema($schema);
That really needs a better way of being handled tho. I'm open to
suggestions.
-ash
More information about the DBIx-Class
mailing list