Then you dont want a deep comparison, you want a shallow comparison. In fact you want the proposed 'looks_like()' method.
Not if my date looks like {day => 5, month => 11, year => 2005} because I need to look inside again. You might argue that the date shouldn't look like that but I just chose date as an example of where you have what is really a value which who's identity is irrelevant. The only reason it even has an identity is because Perl (and many other languages) do not allow you to represent structured values except by using what you might call "anonymous variables". Haskell, relational databases and probably lots of other pure functional languages on the other hand do not force this although they do allow it if you explicitly request it.
Actually it doesn't. At least not in version 0.60
It didn't do that in ver 0.39 (or thereabouts) either but that was reverted because it also fixed (I considered it fixed anyway) the overloaded reference behaviour. Version 0.60 might undo that but it also removes comparison of subrefs and seems to be completely broken for overloaded values, so I wouldn't be too sure that that will stay that way for very long.
Assuming the docs are correct though is_deeply will still never look inside an overloaded object which to my mind is a far bigger sin against deepness than this problem, also not checking blessedness means that 2 deeply equal values will not necessarily react in the same way to method calls (in fact one of them may not even be an object).
I've spent plenty of time arguing about the right thing for is_deeply to do but I stopped when I was convinced that is_deeply is not going anywhere new and that the author was not interested in trying to make it go anywhere new. It seems that its author has now changed his mind somewhat (with the sub refs thing) but I actually think he was right in the first place. It does what it does and it's been doing that for years now. Changing it's behaviour now makes no sense to me.
In reply to Re^3: Do you consider these different or the same?
by fergal
in thread Do you consider these different or the same?
by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |