Skip to content

diff incorrect for identical scalars #2

@abraxxa

Description

@abraxxa

A diff for a hashref containing scalars which values are identical but their default freezer (Storable) return value is different are reported as different:

For example:

my $diff = diff({ port => "1434" }, { port => "1434" }, noU => 1);

print Dumper($diff);

outputs:

{
  D => {
    port => {
      N => "1434",
      O => "1434",
    }
  }
}

I'm still trying to get a failing test case but haven't succeeded so far.

Adding these lines after https://github.com/mr-mixas/Struct-Diff.pm/blob/master/lib/Struct/Diff.pm#L233

print "CHECKING $k\n";
print "\tx: '" . $x->{$k} . "' " . $opts{freezer}($x->{$k}) . "\n";
print "\ty: '" . $y->{$k} . "' " . $opts{freezer}($y->{$k}) . "\n";

for example outputs this:

CHECKING port
	x: '1434' 
                 12345678
1434
	y: '1434' 
                 123451434

Line https://github.com/mr-mixas/Struct-Diff.pm/blob/master/lib/Struct/Diff.pm#L252 causes the failure as it doesn't compare scalars ($type undefined).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions