I'm trying to figure out an easy way to determine if two objects are "equal" - that is, if all of their properties have the same value, without needing to know what the individual properties are.
For instance, if I do this:
a = $data_actors[1]b = $data_actors[2]p a == bI want to know what I could use in place if == to make this evaluate to true.But if I then modify a.features I want the above to evaluate to false.
I need to be able to apply this to ANY of the default data structures, as well as any others that I create via scripts.
I imagine internally, it would need to be something that could automatically list and go through the individual properties of the object and compare them, and if it's a simple data type would just do an == comparison, and if it's a complex data type, it would break it down and compare element by element (for example, a hash or an array). If it inherits from parent classes, it would need to compare all the inherited properties as well.
If they are not equal, I do not need to know which one is greater than or less than the other - just whether they are "the same" or not.
For instance, if I do this:
a = $data_actors[1]b = $data_actors[2]p a == bI want to know what I could use in place if == to make this evaluate to true.But if I then modify a.features I want the above to evaluate to false.
I need to be able to apply this to ANY of the default data structures, as well as any others that I create via scripts.
I imagine internally, it would need to be something that could automatically list and go through the individual properties of the object and compare them, and if it's a simple data type would just do an == comparison, and if it's a complex data type, it would break it down and compare element by element (for example, a hash or an array). If it inherits from parent classes, it would need to compare all the inherited properties as well.
If they are not equal, I do not need to know which one is greater than or less than the other - just whether they are "the same" or not.