[Bug 2055608] Perl 5.32.1 Incorrectly Processes Hash Key Existence in Two-Dimensional Hashes

2022-02-17 Thread bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=2055608



--- Comment #3 from BZ  ---
Thanks for that. Even though semantically it seems like it SHOULD be a bug, for
better or worse at least it's not something unexpected. I just didn't find any
reference to that behavior in the documents I checked. Thanks!


-- 
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2055608
___
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


[Bug 2055608] Perl 5.32.1 Incorrectly Processes Hash Key Existence in Two-Dimensional Hashes

2022-02-17 Thread bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=2055608

Jitka Plesnikova  changed:

   What|Removed |Added

 Resolution|--- |NOTABUG
   Doc Type|--- |If docs needed, set a value
 Status|NEW |CLOSED
Last Closed||2022-02-17 11:42:53



--- Comment #1 from Jitka Plesnikova  ---
This behavior is describe in perldoc for 'exists':


Note that the EXPR can be arbitrarily complicated as long as the 
final operation is a hash or array key lookup or subroutine
name:

if (exists $ref->{A}->{B}->{$key})  { }
if (exists $hash{A}{B}{$key})   { }

if (exists $ref->{A}->{B}->[$ix])   { }
if (exists $hash{A}{B}[$ix]){ }

if (exists &{$ref->{A}{B}{$key}})   { }

Although the most deeply nested array or hash element will not
spring into existence just because its existence was tested, any 
intervening ones will. Thus "$ref->{"A"}" and
"$ref->{"A"}->{"B"}" will spring into existence due to the
existence test for the $key element above. This happens anywhere
the arrow operator is used, including even here:

undef $ref;
if (exists $ref->{"Some key"}){ }
print $ref;  # prints HASH(0x80d3d5c)


-- 
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2055608
___
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure


[Bug 2055608] Perl 5.32.1 Incorrectly Processes Hash Key Existence in Two-Dimensional Hashes

2022-02-17 Thread bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=2055608



--- Comment #2 from Petr Pisar  ---
This feature is called "autovivification". See perlref POD.


-- 
You are receiving this mail because:
You are on the CC list for the bug.
https://bugzilla.redhat.com/show_bug.cgi?id=2055608
___
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/perl-devel@lists.fedoraproject.org
Do not reply to spam on the list, report it: 
https://pagure.io/fedora-infrastructure