Good answer, Beatnik! Allow me to suggest a simplification to your solution. Use SUPER;) and you don't need the TIEHASH routine.
Package Tie::Hash::SaveConfig; @ISA = qw(Tie::StdHash); use strict; sub STORE { my $self = shift; SaveConfig(); $self->SUPER::STORE(@_); # or (probably better) here: # SaveConfig(); } sub SaveConfig { # do something ... print "Config saved\n"; } 1;
Update: Note merlyn's comment below. I put an additional comment into the code. From the original post, though, it's not clear what is actually wanted.
-- Hofmator
In reply to Re: Re: simple tie?
by Hofmator
in thread simple tie?
by L0rdPhi1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |