in reply to Re: Avoiding DBI handles with Storable
in thread Avoiding DBI handles with Storable

When Storable comes across a reference blessed into a class, it examines that class to see if there is a 'STORABLE_freeze' method (and _thaw, I guess, but that's out of the scope of this question) that can produce a "serialized" version of that object. If it exists, according to the documentation for Storable, it's to return a serialized version of the object. If no such method exists (or if the first invocation of this method returns an empty list), Storable reverts to what it normally does.

I am just attempting to define a STORABLE_freeze method for the DBI database handle (which seems to be of the DBI::db class, but I haven't been able to investigate past this point yet), which returns a garbage/no-op serialization for the database handle, much like what Storable does by default when you set $Storable::forgive_me and attempt to serialize a coderef or a file handle. Make sense?

Your code seems to work as-is, though, without error (though your _thaw routine is non-sensical from a Storable point of view, as it does nothing to restore the value that was saved, but that doesn't matter), so I'm wondering if I'm doing something wrong at a more fundamental level...

  • Comment on Re: Re: Avoiding DBI handles with Storable