On Fri Sep 02 13:54:24 2016, leszek@dubiel.pl wrote: > > This is a bug report for perl from leszek@dubiel.pl, > generated with the help of perlbug 1.40 running under perl 5.20.2. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > > This is after the discussion here: > http://www.perlmonks.org/?node_id=1171041 > > Data structure: > > my $n = { > a => [1, 2 ], > b => [3, 4], > }; > > This throws exception: > > @{$$n{'x'}}; > > And this doesn't: > > for my $e (@{$$n{'x'}}) { > } > > Maybe it is somehow connected with autovivification. > > Perhaps it does -- but since you are referencing the 'autovivification' module from CPAN (http://search.cpan.org/~vpit/autovivification-0.16/lib/autovivification.pm#BUGS), you first have to rule out the possibility that this is a bug in that library. Reports sent to rt.perl.org should be concerned only with the Perl 5 core distribution. The 'autovivification' library is not part of the core distribution. Please report this problem first to the CPAN maintainer of 'autovivification' via sending mail to: bug-autovivification [at] rt.cpan.org If the discussion there discloses a bug in the Perl 5 core distribution, then we can open a new ticket here or re-open this one. > > > Here is program: > > #!/usr/bin/perl -CSDA > > use utf8; > use strict; > use warnings; > no warnings qw{uninitialized numeric}; > no autovivification; # qw{fetch exists delete store}; > use Data::Dumper; > Note for when you report this problem at rt.cpan.org: Much of what you have above is superfluous for the purpose of filing a bug report. You can and should eliminate the '-CSDA'; the 'use utf8'; and the 'no warnings qw{uninitialized numeric}'. Strip down the code sample to the minimum code that reproduces the problematic behavior. > print "\n\ninitialize data structures, no autovivification\n"; > my $n = { > a => [1, 2 ], > b => [3, 4], > }; > $$n{'x'}{'y'}{'z'} and die; > $$n{'x'}{'y'}[0] and die; > $$n{'x'}{'y'} and die; > $$n{'x'} and die; > print "so far, so good, no 'x' autovivified:\n"; > print Dumper $n; > > # "Can't use an undefined value as an ARRAY reference": > # @{$$n{'x'}} and die; > > print "\n\nnow the same but in loop:\n"; > for my $e (@{$$n{'x'}}) { > } > print "why 'x' autovivified?\n"; > print Dumper $n; > > print "\n\nnow the same but in loop:\n"; > for my $e (@{[ $$n{'y'} ]}) { > } > print "why 'y' NOT autovivified?\n"; > print Dumper $n; Thank you very much. -- James E Keenan (jkeenan@cpan.org) --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=129177Thread Previous | Thread Next