[Dbix-class] Row object does not work correctly after thaw.

Ash Berlin ash_cpan at firemirror.com
Fri May 8 10:12:47 GMT 2009

On 8 May 2009, at 10:09, Oleg Pronin wrote:

> Hello.
> DBIx::Class::ResultSourceHandle has storable hooks to correctly  
> store row object and restore it.
> However after restore, trying to update such an object will fail:
> Can't call method "update" on an undefined value at /usr/local/lib/ 
> perl5/site_perl/5.10.0/DBIx/Class/Row.pm line 490.
> Because $obj->result_source->schema isn't a correct schema,    $obj- 
> >result_source->schema->storage is undefined
> It would be great to attach correct schema. Can someone fix that?

This is because you thawed it 'wrong'.

This http://search.cpan.org/perldoc?DBIx::Class::ResultSourceHandle  
says the following about thawing:

Thaws frozen handle. Resets the internal schema reference to the  
package variable $thaw_schema. The recomened way of setting this is to  
use $schema->thaw($ice) which handles this for you.

Alternatively, if you use Catalyst you can set

local $DBIx::Class::ResultSourceHandle::thaw_schema = $c- 

or similar somewhere near the start of your request (can't be in an  
action, it wouldn't localize right)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090508/6af16080/attachment.htm

More information about the DBIx-Class mailing list