So, I want to use the Storable module to make my objects persistent, but I can't seem to use what Storable says are "inheritable" features. For instance, so I have some code like this:
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;
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?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.