On Wed, Dec 11, 2002 at 03:20:59PM -0700, Ken Miller wrote:
> I'm playing around with using Cache::MemoryCache to store some database
> 'objects'.  However, when I stuff an object into the cache, and the cache
> goes out of scope, I get these messages:
> 
>         (in cleanup) dbih_getcom handle DBI::dr=HASH(0x8ddfc8) is not a DBI
> handle (has no magic) during global destruction.
> 
> Can someone explain to me what's going on?  I think it has something to do
> with how Cache::Cache stores references.  As a simple test, I created a
> reference, blessed it into a package, and inserted it into the cache.  Each
> time I fetched the object from the cache, the reference was **different**.
> So some sort of copying is going on behind the scenes.  I'm sure this is
> causing some DBI stuff to go out of scope, and be released (but not totally
> freed, since the refcounts are all 1 for the above objects.  So perhaps some
> sort of corruption?)

The code is probably treating the DBI handle as any other blessed hash ref.
It would store the contents of the hash and the class it was blessed into.
Then it would 'reconstruct' the object by loading up a new hash and blessing it.

The end result may look like a DBI handle, but it's not. As the
error message says, it "has no magic" :)

> I doubt from the error I'm seeing above that I can safely us it in a
> production environment.

Not a question of safely. It just won't work.

Tim.

Reply via email to