Fastolfe has asked for the wisdom of the Perl Monks concerning the following question:
My thought then was to take advantage of the Storable hooks, and simply write one for DBI::db that passed back a string "Lost DBI ref $ref" along the same lines that setting $Storable::forgive_me allows a simple "lost data" string to appear in place of file handles or other un-storable data. This is how I approached it:
When executing with this subroutine in place, however, I get this error message:sub DBI::db::STORABLE_freeze { my ($self, $cloning) = @_; return if $cloning; return "Lost DBI ref $self"; }
Both this error message and store_hook() itself appear to be in the .so for Storable, not in any of the Perl code, so short of downloading the source (which is my next logical step, after this), it's difficult to see what it's talking about. The documentation only mentions that hooks need to return a "serialized version" of the object being passed. I have also tried returning other things:Unexpected object type (4) in store_hook() at blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/_freeze.al) line 234, at script-name.pl line 58
I'm guessing the "serialized version" needs to be a little more "serialized" than this, but how do I need to go about doing this?return freeze("string"); # probably 'cause it's not a ref my $$msg = "string"; return freeze($msg); # still no-go
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Avoiding DBI handles with Storable
by runrig (Abbot) on Jan 31, 2001 at 05:00 UTC | |
by Fastolfe (Vicar) on Jan 31, 2001 at 05:05 UTC | |
|
Re: Avoiding DBI handles with Storable
by Fastolfe (Vicar) on Feb 07, 2001 at 04:46 UTC |