Skip Menu |

This queue is for tickets about the Data-Dump CPAN distribution.

Report information
The Basics
Id: 102792
Status: rejected
Priority: 0/
Queue: Data-Dump

People
Owner: Nobody in particular
Requestors: andrew [...] illywhacker.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Data::Dump modifying Hash
Date: Sun, 15 Mar 2015 23:29:03 +0000
To: bug-Data-Dump [...] rt.cpan.org
From: Andrew Solomon <andrew [...] illywhacker.net>
Here's the setup: * Linux: Linux 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux * Perl: v5.18.1 built for x86_64-linux * Data::Dump 1.22 I know that the BUG HERE line has no sensible meaning. I was just trying to figure out why I don't get an error running it. In the process though I got the output below. ================================== use strict; use warnings; use Data::Dump 'pp'; use Data::Dumper; use feature 'say'; { say 'Hash'; my %hash = ( alpha => 'foo', beta => 'bar' ); say pp (\%hash); say pp($hash{'foo','bar'}); # BUG HERE say pp (\%hash); } ======================================= $ ./foo.pl Hash { alpha => "foo", beta => "bar" } undef { "alpha" => "foo", "beta" => "bar", "foo\34bar" => undef }
This behaviour is just how Perl itself works.  It has nothing to do with Data::Dump.
On 2015-03-17 13:13:28, GAAS wrote: Show quoted text
> This behaviour is just how Perl itself works. It has nothing to do with > Data::Dump.
I don't think so. The same script with pp() replaced by Dumper() does not autovivify.
On Tue Mar 17 16:18:23 2015, SREZIC wrote:
Show quoted text
> On 2015-03-17 13:13:28, GAAS wrote:
> > This behaviour is just how Perl itself works. It has nothing to do
> > with
> > Data::Dump.
>
> I don't think so. The same script with pp() replaced by Dumper() does
> not autovivify.

Ok.  The issue seems to be that pp() ends up evaluating \$_[0] which does force autovivification.  Consider it a feature then :-)