Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 26493
Status: resolved
Priority: 0/
Queue: String-Diff

People
Owner: Nobody in particular
Requestors: mbautin [...] gmail.com
Cc:
AdminCc:

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



Subject: String::Diff::diff-0.02 invalid handling of zeros
Date: Thu, 19 Apr 2007 13:31:05 -0400
To: bug-String-Diff [...] rt.cpan.org
From: "Michael Bautin" <mbautin [...] gmail.com>
I am using String::Diff-0.02. The command perl -e 'use String::Diff; print join(", ", String::Diff::diff("10", "12"))."\n"; ' outputs 1, 1{2} which should have been 1[0], 1{2} On the other hand, if I replace 0 with 3, I get: perl -e 'use String::Diff; print join(", ", String::Diff::diff("13", "12"))."\n"; ' 1[3], 1{2} So I suppose this is something related to boolean evaluation of zeros. Mikhail Bautin mbautin(*at*)cs(*dot*)sunysb(*dot*)edu
Subject: [rt.cpan.org #26493]
Date: Thu, 19 Apr 2007 13:43:06 -0400
To: bug-String-Diff [...] rt.cpan.org
From: "Michael Bautin" <mbautin [...] gmail.com>
Currently I am working around this bug in the following way: # Fixes the zero bug in String::Diff by replacing zeros with another character. # TODO Choose the replacement character so that neither s1 nor s2 contain it. sub _diff_fix_zero_bug($$@) { my $zero_repl = '\0xfe'; my ($s1, $s2, @params) = @_; $s1 =~ tr/0/$zero_repl/; $s2 =~ tr/0/$zero_repl/; my $diff = String::Diff::diff($s1, $s2, @params); return [ map { $_ =~ tr/$zero_repl/0/; $_; } @$diff ]; } PS: Thanks for the String::Diff module! Best regards, Mikhail Bautin
This zero bug was a thing by a simple mistake. Corrected what was assumed to be 0.03 and upload was done to CPAN. We wish to express our gratitude for your report.