in reply to Re^2: Ironclad protection of instance data
in thread Ironclad protection of instance data
What does $phrase {$self} do?
It uses the stringified reference at $self as the key for a lexical hash. The hash is unreachable outside of the module, but is shared between all the instances of that object, so you have to key it on something unique. Using the stringified reference is a convenient way to do that.
Update: just to clarify a bit what I mean by stringified reference:
$ perl -le 'my $self = {}; print $self' HASH(0x814cc20)
Something like that would be used as the hash key. Since that contains a memory location, it will be unique (unless something Very Bad happens).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Ironclad protection of instance data
by friedo (Prior) on Jul 04, 2004 at 17:36 UTC |