Skip Menu |
 

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

Report information
The Basics
Id: 109262
Status: new
Priority: 0/
Queue: Data-Difference

People
Owner: Nobody in particular
Requestors: Peter [...] PSDT.com
Cc:
AdminCc:

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



Subject: Undef key in first argument is ignored
Date: Fri, 20 Nov 2015 15:53:20 -0800
To: bug-Data-Difference [...] rt.cpan.org
From: Peter Scott <Peter [...] PSDT.com>
Download (untitled) / with headers
text/plain 1.9k
% perl -MData::Difference=data_diff -MData::Dumper -e 'print Dumper $_ for data_diff {z=>undef}, {z=>"foo"}' % perl -MData::Difference=data_diff -MData::Dumper -e 'print Dumper $_ for data_diff {z=>"foo"}, {z=>undef}' $VAR1 = { 'a' => 'foo', 'b' => undef, 'path' => [ 'z' ] }; The first one should produce this result but shows no difference: $VAR1 = { 'a' => undef, 'b' => 'foo', 'path' => [ 'z' ] }; This should do it: *** /usr/local/lib/perl5/site_perl/5.18.1/Data/Difference.pm.orig 2015-11-20 15:43:25.000000000 -0800 --- /usr/local/lib/perl5/site_perl/5.18.1/Data/Difference.pm 2015-11-20 15:52:57.000000000 -0800 *************** *** 50,56 **** push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } ! elsif (defined $a->{$k} ? defined $b->{$k} ? $b->{$k} ne $a->{$k} : 1 : 0) { push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } --- 50,56 ---- push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } ! elsif (defined $a->{$k} ? defined $b->{$k} ? $b->{$k} ne $a->{$k} : 1 : defined $b) { push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } *************** *** 80,86 **** push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } ! elsif (defined $a->[$i] ? defined $b->[$i] ? $b->[$i] ne $a->[$i] : 1 : 0) { push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } --- 80,86 ---- push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } ! elsif (defined $a->[$i] ? defined $b->[$i] ? $b->[$i] ne $a->[$i] : 1 : defined $b->[$i]) { push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } }
Subject: Re: [rt.cpan.org #109262] AutoReply: Undef key in first argument is ignored
Date: Fri, 20 Nov 2015 16:03:58 -0800
To: bug-Data-Difference [...] rt.cpan.org
From: Peter Scott <Peter [...] PSDT.com>
Download (untitled) / with headers
text/plain 1.4k
Sorry, slight bug in patch, fix: *** /usr/local/lib/perl5/site_perl/5.18.1/Data/Difference.pm.orig 2015-11-20 15:43:25.000000000 -0800 --- /usr/local/lib/perl5/site_perl/5.18.1/Data/Difference.pm 2015-11-20 16:02:57.000000000 -0800 *************** *** 50,56 **** push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } ! elsif (defined $a->{$k} ? defined $b->{$k} ? $b->{$k} ne $a->{$k} : 1 : 0) { push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } --- 50,56 ---- push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } ! elsif (defined $a->{$k} ? defined $b->{$k} ? $b->{$k} ne $a->{$k} : 1 : defined $b->{$k}) { push @diff, {path => [@path, $k], a => $a->{$k}, b => $b->{$k}}; } } *************** *** 80,86 **** push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } ! elsif (defined $a->[$i] ? defined $b->[$i] ? $b->[$i] ne $a->[$i] : 1 : 0) { push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } --- 80,86 ---- push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } } ! elsif (defined $a->[$i] ? defined $b->[$i] ? $b->[$i] ne $a->[$i] : 1 : defined $b->[$i]) { push @diff, {path => [@path, $i], a => $a->[$i], b => $b->[$i]}; } }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.