Skip Menu |

This queue is for tickets about the HTML-Diff CPAN distribution.

Report information
The Basics
Id: 6756
Status: resolved
Priority: 0/
Queue: HTML-Diff

People
Owner: ezra [...] ezrakilty.net
Requestors: asjo [...] koldfront.dk
Cc:
AdminCc:

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



Subject: HTML::Diff between '0' and '' returns the triplet ('-', '', '')
Using HTML:Diff 0.55, running this simple test-script: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use HTML::Diff; my $left='0'; my $right=''; my $diffs=html_word_diff($left, $right); print Dumper($left, $right, $diffs); yields the output: $VAR1 = '0'; $VAR2 = ''; $VAR3 = [ [ '-', '', '' ] ]; I would expect the (deleted) zero to appear in the triplet? I'm using perl 5.6.1 on a Debian/stable box. Thanks for making HTML:Diff! Adam.
From: asjo [...] koldfront.dk
Here is a patch that fixes the problem: --- html-diff-0.55/lib/HTML/Diff.pm Tue Apr 27 09:44:36 2004 +++ /usr/local/share/perl/5.6.1/HTML/Diff.pm Fri Jun 25 15:18:50 2004 @@ -107,8 +107,10 @@ $lbuf = ""; $rbuf = ""; } - $lbuf .= elem_mkp($left) || ''; - $rbuf .= elem_mkp($right) || ''; + my $lelem=elem_mkp($left); + my $relem=elem_mkp($right); + $lbuf .= (defined $lelem ? $lelem : ''); + $rbuf .= (defined $relem ? $relem : ''); $lastsignal = $signal; } push @result, [$lastsignal, $lbuf, $rbuf];
I believe this to be fixed with version 0.56.