Skip Menu |

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

Report information
The Basics
Id: 39184
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Array-Diff

People
Owner: NEILB [...] cpan.org
Requestors: stmckinn [...] cisco.com
Cc:
AdminCc:

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



Subject: Array-Diff bug
Date: Thu, 11 Sep 2008 13:44:55 -0400
To: <bug-Array-Diff [...] rt.cpan.org>
From: "Steve Mckinney (stmckinn)" <stmckinn [...] cisco.com>
The program at the bottom of the email shows a bug in Array-Diff. I think it has to do with the ordering of the array items. It should print: old : 139 22 new : 22 137 139 3306 del : add : 137 3306 Thank you, Steve #!/usr/bin/perl use strict; use Array::Diff; my @old = (139,22); my @new = (22,137,139,3306); print "old : @old" . "\n" . "new : @new" . "\n\n"; my $diff = Array::Diff->diff(\@old, \@new); my @del = map {$_} (@{$diff->deleted}); my @add = map {$_} (@{$diff->added}); print "del : @del" . "\n" . "add : @add" . "\n";
This is not a bug if you want that functionality then you need to sort your inputs. perl -e ' use strict; use Array::Diff; my @old = sort(139,22); my @new = sort(22,137,139,3306); print "old : @old" . "\n" . "new : @new" . "\n\n"; my $diff = Array::Diff->diff(\@old, \@new); my @del = map {$_} (@{$diff->deleted}); my @add = map {$_} (@{$diff->added}); print "del : @del" . "\n" . "add : @add" . "\n"; '
Subject: RE: [rt.cpan.org #39184] Array-Diff bug
Date: Mon, 22 Sep 2008 12:48:26 -0400
To: <bug-Array-Diff [...] rt.cpan.org>
From: "Steve Mckinney (stmckinn)" <stmckinn [...] cisco.com>
The documentation should specify that the input must consist of sorted arrays. Steve Show quoted text
-----Original Message----- From: Michael R. Davis via RT [mailto:bug-Array-Diff@rt.cpan.org] Sent: Monday, September 22, 2008 12:10 PM To: Steve Mckinney (stmckinn) Subject: [rt.cpan.org #39184] Array-Diff bug <URL: http://rt.cpan.org/Ticket/Display.html?id=39184 > This is not a bug if you want that functionality then you need to sort your inputs. perl -e ' use strict; use Array::Diff; my @old = sort(139,22); my @new = sort(22,137,139,3306); print "old : @old" . "\n" . "new : @new" . "\n\n"; my $diff = Array::Diff->diff(\@old, \@new); my @del = map {$_} (@{$diff->deleted}); my @add = map {$_} (@{$diff->added}); print "del : @del" . "\n" . "add : @add" . "\n"; '
Fixed (added note to this effect in the documentation) in 0.09.