sub STORE { my ($self, $key, $val) = @_; # assuming this class has more than just 'foo'... unless (grep { $_ eq $key } @CLASS_KEYS ) { croak (ref $self) . "has no $key member"; } if ($key eq 'foo') { $self->[1] = localtime(); # track last change $self->[0] = $val; $self->_recalculate_bar(); } else { # set normal keys somehow } } sub FETCH { my ($self, $key, $val) = @_; # assuming this class has more than just 'foo'... unless (grep { $_ eq $key } @CLASS_KEYS ) { croak (ref $self) . "has no $key member"; } if ($key eq 'foo') { $self->[2] = localtime(); # track last access return $self->[0]; } else { # get normal keys somehow } }