Hrunting has asked for the wisdom of the Perl Monks concerning the following question:
The problem is, that once I'm in STORABLE_freeze/thaw, I can't access the functions of my parent without either a) generating an error or b) throwing myself into an endless loop where I'm repeatedly calling myself. How in the world are you supposed to use Storable's routines from when you're being called as the Storable freeze/thaw function?package MyModule; sub STORABLE_freeze { my $this = shift; my $value = $this->{'key'}; delete $this->{'key'}; my $serialized = $this->SUPER::STORABLE_freeze( @_ ); # or $this->SUPER::freeze( @_ ) or etc. etc. $this->{'key'} = $key; return $serialized; } sub STORABLE_thaw { my $this = shift; $this->SUPER::STORABLE_thaw( @_ ); # or $this->SUPER::thaw( @_ ) or any other arrangment $this->post_loaded_function(); } 1;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using Storable effectively
by arturo (Vicar) on Apr 18, 2001 at 20:40 UTC | |
by Hrunting (Pilgrim) on Apr 18, 2001 at 20:55 UTC | |
by Hrunting (Pilgrim) on Apr 18, 2001 at 21:06 UTC | |
Re: Using Storable effectively
by repson (Chaplain) on Apr 19, 2001 at 12:58 UTC |