4 ms·
Autovivifying variables is wildly out there. I feel your pain! Autovivifying properties of a dictionary could certaintly lead to some bugs, but as presented he
by braythwayt 8y ago
Autovivifying variables is wildly out there. I feel your pain!
Autovivifying properties of a dictionary could certaintly lead to some bugs, but as presented here, checking for existence won’t invoke autovivification.
- tkahnoski 8y agoIndeed. I wish with Perl I had a way to be explicit about when I could disable this behavior but its builtin to the language to such a degree to be unavoidable. (Using different Perl object frameworks and getter/setter methods is a possibility to protect against this class of error) The implementation provided in the article is at least a known property of that particular object type and not a property of all objects.
- draegtun 8y agoYou can switch off or amend autovivification behaviour using this pragma module - https://metacpan.org/pod/autovivification https://metacpan.org/pod/autovivification no autovivification; # switches off autoviv except for setting no autovivification 'exists'; # just for exists checks
- tkahnoski 8y agoOMG. All I have to say is thank you.