I might reuse the same date object multiple times in the expected values even though the result values have multiple different occurrences of the same date value. I don't want that to be a problem.

Then you dont want a deep comparison, you want a shallow comparison. In fact you want the proposed 'looks_like()' method.

Finally in relation to is_deeply, it considers

$a=[]; is_deeply($a, "$a");
to be a pass.

Actually it doesn't. At least not in version 0.60

I and others know exactly what it's doing. Sometimes I use it, mostly I don't but changing its behaviour at this stage risks breaking tests and

My position is that we can eliminate the confusion by making is_deeply() do a proper deep structural comparison and provide a different routine (that would conveniently share its implementation with is_deeply).

Long term I believe this would clear up a LOT of misunderstanding about references that I see even experienced Perl programmers making. Misunderstanding such as is_deeply() considering $ar1 and $ar2 to be the same, which is just totally wrong.

my ($x,$y,$ar1); $x=\$y; $y=\$x; $ar1=[$x,$y]; my $ar2; $ar2->[0]=\$ar2->[1]; $ar2->[1]=\$ar2->[0]; is_deeply($ar1,$ar2); #this is wrong, wrong, wrong.

If is_deeply()'s behaviour doesn't change then it should have very large warnings on it that it doesnt do what it claims to do (that is checking if the objects are deep copies of each other.)

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


In reply to Re^2: Do you consider these different or the same? by demerphq
in thread Do you consider these different or the same? by demerphq

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.