class::dbi and storing/thawing?

Ken Burcham ken@burcham.com
Tue, 04 May 2004 08:50:54 -0400


Well, after writing a test to confirm Class::DBI didn't work with 
Storable, lo and behold my tests all worked.  So after continued 
excavating, it turned out to be something obscure in how I 
dynamically construct my Class::DBI objects and had tried to use 
it before I'd constructed it.

So just for the sake of completeness, Class::DBI objects 
serialize just fine with memcached (and Storable).

thanks!
and thanks for memcached.

ken.

On 3 May 2004 at 14:53, Brad Fitzpatrick <brad@danga. wrote:

> Thanks Brad!
> 
> I'll do that very thing.
> 
> ken.
> 
> On 3 May 2004 at 11:47, Brad Fitzpatrick wrote:
> 
> > Cache::Memcached just uses Storable, so if that can't freeze/thaw things
> > properly, neither can Cache::Memcached.
> > 
> > I suspect the problem with Class::DBI is that it holds some of its
> > attributes in package globals or hangs onto $dbh references which are no
> > longer valid after unthawing.
> > 
> > I'd whip up a wrapper script using Storable and submit a failing test-case
> > to the Class::DBI maintainers, asking them why it's not serializable.
> > 
> > - Brad
> > 
> > 
> > On Mon, 3 May 2004, Ken Burcham wrote:
> > 
> > > Hi memcached gurus,
> > >
> > >   I'm giving memcached a spin and can store a hitcounter (what
> > > fun) but when I try to store what I'm really after, Class::DBI
> > > (http://search.cpan.org/~tmtm/Class-DBI-0.96/lib/Class/DBI.pm)
> > > objects, I get no joy.  Class::DBI objects have methods and
> > > attributes, and neither work after 'set'ing and 'get'ing one in
> > > memcached.
> > >
> > > Here's the error:
> > >
> > > [Mon May 03 14:33:44 2004] [error] [client 10.10.20.41] Can't
> > > locate object method "languagecode" via package
> > > "GCX::Runtime::Input::Table::global::community" at
> > > /usr/lib/perl5/site_perl/5.8.0/GCX/Runtime/Output/Handler.pm line
> > > 122, <Sock_172.16.1.123:11211> line 1.
> > >
> > > The object works fine before I store it, i.e. i can use the
> > > languagecode method, etc.
> > >
> > > So my question, I guess, is about the storing and thawing...
> > > What sorts of limitations are there?  Or what kinds of objects
> > > can I store and what kinds can't I?  Sorry if this is a FAQ, I
> > > didn't see one...  Happy to be pointed in the right direction!
> > >
> > > thanks so much!
> > >
> > > ken.
> > >
> > > --
> > > Ken Burcham
> > > Ken Burcham Consulting, Inc.
> > > http://www.capemaystation.com
> > >
> > >
> > >
> 
> 

-- 
Ken Burcham
Ken Burcham Consulting, Inc.
http://www.capemaystation.com