Subject: | Array::Diff->count returns wrong number |
Date: | Fri, 23 Jan 2015 18:00:40 +0200 |
To: | bug-Array-Diff [...] rt.cpan.org |
From: | Alexander Shikov <a.shikov [...] dtel-ix.net> |
Hello!
Bug is reproducible with simple example:
#!/usr/bin/perl
use warnings;
use strict;
use Array::Diff;
use Data::Dumper;
my $old = [ 'a' ];
my @new = ( 'b', 'c', 'd' );
my $diff = Array::Diff->diff( $old, \@new );
my $cnt = $diff->count;
my $add_ref = $diff->added;
my $del_ref = $diff->deleted;
print "cnt=$cnt\n";
print "add: ", Dumper( $add_ref ), "\n";
print "del: ", Dumper( $del_ref ), "\n";
print "add-list: ", @{$add_ref}, "\n";
print "del-list: ", @{$del_ref}, "\n";
__END__
cnt=1
add: $VAR1 = [
'b',
'c',
'd'
];
del: $VAR1 = [
'a'
];
add-list: bcd
del-list: a
$diff->count should be 4, not 1.
--
Alexander Shikov
Technical Staff, Digital Telecom IX
Tel.: +380 44 201 14 07
http://dtel-ix.net/