Argel has asked for the wisdom of the Perl Monks concerning the following question:
So now I'm curious -- what's the rationale behind it? Is it just something hard to code around in the Perl 5 codebase? Or something else? Would it be possible to have perl throw a warning in a future 5.10 (or 5.12) release?
Obligatory code snippets....
# Broken version: next LASTLOG unless exists $user_by_uid{$uid}->{$host}; # Data::Dumper output when $uid is not in the hash: $user_by_uid = { '93688' => {}, '58684' => {}, '58017' => {}, }; # Fixed version: next LASTLOG unless exists $user_by_uid{$uid} && exists $user_by_uid{$ +uid}->{$host};
Update: I'd like to thank everyone for the replies. I was interested in the history of why it was designed/implemented this way and perrin gave me some things to look at in 659433. I'd like to thank ikegami for his answers in the 659446 thread and special thanks to tye for his responses in Re: Why does exists cause autovivication? (myth, mods) and 659643 respectively. Again, thanks everyone!
Update2: I'd especially like to thank demerphq for his reply in: "Re^7: Why does exists cause autovivication?"!
Happy Holidays!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Why does exists cause autovivication?
by perrin (Chancellor) on Dec 29, 2007 at 03:06 UTC | |
Re: Why does exists cause autovivication? (myth, mods)
by tye (Sage) on Dec 29, 2007 at 05:56 UTC | |
by Dumu (Monk) on Jul 09, 2015 at 09:24 UTC | |
by tye (Sage) on Jul 09, 2015 at 17:18 UTC | |
Re: Why does exists cause autovivication?
by chromatic (Archbishop) on Dec 29, 2007 at 03:17 UTC | |
by Anonymous Monk on Dec 29, 2007 at 04:18 UTC | |
by Fletch (Bishop) on Dec 29, 2007 at 05:22 UTC | |
by perrin (Chancellor) on Dec 29, 2007 at 05:50 UTC | |
Re: Why does exists cause autovivication?
by ikegami (Patriarch) on Dec 29, 2007 at 04:43 UTC | |
by Argel (Prior) on Dec 29, 2007 at 21:12 UTC | |
by ikegami (Patriarch) on Dec 29, 2007 at 22:40 UTC | |
by Argel (Prior) on Dec 30, 2007 at 15:41 UTC | |
by demerphq (Chancellor) on Dec 31, 2007 at 08:51 UTC | |
| |
by tye (Sage) on Dec 30, 2007 at 17:13 UTC | |
Re: Why does exists cause autovivication?
by graff (Chancellor) on Dec 29, 2007 at 07:07 UTC | |
by jrw (Monk) on Dec 30, 2007 at 07:40 UTC | |
Re: Why does exists cause autovivication?
by Dumu (Monk) on Jul 09, 2015 at 09:19 UTC | |
A reply falls below the community's threshold of quality. You may see it by logging in. |