<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 8 May 2009, at 10:09, Oleg Pronin wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello.<br><br>DBIx::Class::ResultSourceHandle has storable hooks to correctly store row object and restore it.<br>However after restore, trying to update such an object will fail:<br><br>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.<br> <br>Because $obj->result_source->schema isn't a correct schema, $obj->result_source->schema->storage is undefined<br><br>It would be great to attach correct schema. Can someone fix that?<br></blockquote></div><br><div><br></div><div>This is because you thawed it 'wrong'. </div><div><br></div><div>This <a href="http://search.cpan.org/perldoc?DBIx::Class::ResultSourceHandle">http://search.cpan.org/perldoc?DBIx::Class::ResultSourceHandle</a> says the following about thawing:</div><div><br></div><div><span class="Apple-style-span" style="font-family: sans-serif; font-size: medium; ">Thaws frozen handle. Resets the internal schema reference to the package variable <code>$thaw_schema</code>. The recomened way of setting this is to use <code>$schema-></code>thaw($ice) which handles this for you.</span></div><div><font class="Apple-style-span" face="-webkit-sans-serif"><br></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif">Alternatively, if you use Catalyst you can set </font></div><div><font class="Apple-style-span" face="-webkit-sans-serif"><br></font></div><div><font class="Apple-style-span" face="-webkit-sans-serif">local $DBIx::Class::ResultSourceHandle::thaw_schema = $c->model('MyDBIC')->schema;</font></div><div><br></div><div>or similar somewhere near the start of your request (can't be in an action, it wouldn't localize right)</div><div><br></div><div>-ash</div></body></html>