qq has asked for the wisdom of the Perl Monks concerning the following question:
I've got an easy Set problem. I have two lists of objects and I want intersection and difference, etc.
BUT I'd like to have them be compared by calling $_->id rather than refaddr $_. I don't think either Set::Object or Set::Scalar allow the user to provide an identity comparison function, or make clear how to subclass to change identity comparison.
Am I missing it, or is there another module that allows this? It seems like a common need.
thanks
update: edited for clarity
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Set modules and object comparison
by Joost (Canon) on Sep 17, 2007 at 19:26 UTC | |
Re: Set modules and object comparison
by kyle (Abbot) on Sep 17, 2007 at 18:35 UTC | |
Re: Set modules and object comparison
by suaveant (Parson) on Sep 17, 2007 at 19:19 UTC | |
Re: Set modules and object comparison
by qq (Hermit) on Sep 18, 2007 at 11:30 UTC |
Back to
Seekers of Perl Wisdom