in reply to Re: Preventing autovivification
in thread Preventing autovivification
In addition to this, you need to isolate the object (inside out) from the implementation (hash). In short, there is no way to stop an attribute from being added to a hash data structure. Auto-vivification is just part of the behavior of hashes.
You can achieve like-hashes that don't auto-vivify like this with Variable::Magic or Tie::HashRef, but I believe this to be outside the scope of the question.
With an inside hash, you would typically control autovivification with the set method.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Preventing autovivification
by BrowserUk (Patriarch) on Feb 16, 2010 at 05:51 UTC |