|There's more than one way to do things|
Set modules and object comparisonby qq (Hermit)
|on Sep 17, 2007 at 17:51 UTC||Need Help??|
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.
update: edited for clarity