in reply to Re: Do you consider these different or the same?
in thread Do you consider these different or the same?

Under that usage, is_deeply() needs to see both the posted datastructures as equal.

I dont understand. You want is_deeply() to gloss over the fact that your hand constructed example is different from what it returns? Why is this good? And please before you use the example that Schwern did in a post, think about somethign like this:

my %expect_hash=(a=>1,b=>2); my @expect=({%expect_hash},{%expect_hash}); #versus my @copies=(\%expect_hash,\%expect_hash);

Is the extra char too much price to pay for is_deeply() doing what its name says it does? (this isn't intended as a snarky question, I really am curious.)

---
$world=~s/war/peace/g

Replies are listed 'Best First'.
Re^3: Do you consider these different or the same?
by hardburn (Abbot) on Jul 01, 2005 at 14:09 UTC

    (I don't see the Schwern post you mentioned in this thread. Is it someplace else?)

    All I see for is_deeply()'s documentation is:

    Similar to is(), except that if $this and $that are hash or array references, it does a deep comparison walking each data structure to see if they are equivalent. If the two structures are different, it will display the place where they start differing.

    Which, to me, just means it will make sure all the values in the nested data structure are the same. Wheather the actual references are the same is irrelevent in most of the code I've encountered. Of course, there are always exceptions, so a seperate sub that has a more exact definition of equivilence is likely needed.

    "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.