[Dbix-class] Serialize::Storable and InflateColumn::DateTime

Matt S Trout dbix-class at trout.me.uk
Wed Nov 14 16:25:52 GMT 2007


On Wed, Nov 14, 2007 at 12:00:42PM +0100, Tobias Kremer wrote:
> I was just checking out Serialize::Storable together with some simple
> custom memcached functionality implemented in a Catalyst controller. I'm
> getting this error when trying to use the cached version of my ResultSet:
> 
> Can't call method "datetime_parser" on an undefined value at
> /usr/local/share/perl/5.8.8/DBIx/Class/InflateColumn/DateTime.pm line 81
> 
> The cache stuff in the controller is as simple as:
> 
> my $rs;
> unless( $rs = $c->cache->get( 'rs' ) ) {
>   $rs = $c->model(...)->search(...);
>   $c->cache->set( 'rs', $rs, 3600 );
> }
> 
> Removing the InflateColumn::DateTime component and inflating/deflating the
> datetime fields manually in my schema class makes the caching stuff work
> w/o problems.

You've lost your ResultSource object; the serialize stuff just makes it
serialize ok, it can't reconnect it.

You'll need to reset $obj->result_source($schema->source('Name')).

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/



More information about the DBIx-Class mailing list