Skip Menu |

This queue is for tickets about the List-Compare CPAN distribution.

Report information
The Basics
Id: 112938
Status: open
Priority: 0/
Queue: List-Compare

People
Owner: Nobody in particular
Requestors: BBYRD [...] cpan.org
Cc:
AdminCc:

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



Subject: List::Compare mangles non-string lists
If you pass a couple of lists of objects, List::Compare returns back the stringified version of those objects on any intersection call. This is because the engines rely on returning back the stringified keys of these objects, instead of returning the objects themselves. For example: my @full_list = ( BlessedObject->new(1), BlessedObject->new(2), BlessedObject->new(3), BlessedObject->new(4), ); my @partial_list = ( $full_list[1], $full_list[3] ); my $lc = List::Compare->new( { lists => [ \@full_list, \@partial_list ], accelerated => 1, unsorted => 1, } ); # $lc has good objects currently, mainly because of 'accelerated' my @other_half = $lc->get_Lonly; # @other_half is nothing but stringified things Sure, @other_half could then be parsed to compare against the stringified forms of @full_list, but that seems like it would defeat the purpose of using a module to do this.
On Fri Mar 11 17:27:47 2016, BBYRD wrote: Show quoted text
> If you pass a couple of lists of objects, List::Compare returns back > the stringified version of those objects on any intersection call. > This is because the engines rely on returning back the stringified > keys of these objects, instead of returning the objects themselves. > > For example: > > my @full_list = ( > BlessedObject->new(1), > BlessedObject->new(2), > BlessedObject->new(3), > BlessedObject->new(4), > ); > my @partial_list = ( > $full_list[1], $full_list[3] > ); > > my $lc = List::Compare->new( { > lists => [ \@full_list, \@partial_list ], > accelerated => 1, > unsorted => 1, > } ); > > # $lc has good objects currently, mainly because of 'accelerated' > > my @other_half = $lc->get_Lonly; > > # @other_half is nothing but stringified things > > Sure, @other_half could then be parsed to compare against the > stringified forms of @full_list, but that seems like it would defeat > the purpose of using a module to do this.
Let me be frank: In 14 years no one has ever suggested that the items in the sets which List::Compare processes should be anything other than strings. So supporting lists of objects is outside of this library's historical scope and is not likely to be supported in the future. I will add a note to that effect to the next version released to CPAN. Thank you very much. Jim Keenan