Hey all,

Is there an is_deeply()-esque function somewhere that does not belong to a test module? It works perfectly for what I'm trying to do, but I can't get the test output to redirect properly, and it interferes with my actual unit tests.

I've put some code I was toying with for testing below, just because it's the right thing to do on PerlMonks when asking a question. It's awful for many reasons, fails unsafely, and uses experimental features. I'm sure things will click together when I look at it tomorrow, but the ol' brain has given up thinking with it being Friday afternoon and all.

In the code, I've shortened certain things to fit reasonably nicely... s/current/c/, s/previous/p/. The structure is a hash ref that contains either strings or arrays.

self->{cache_safe} = 1; my @unsafe_cache_params = qw(file extensions include exclude search); my $c = $self->{params}; my $p = $self->{p_run_config}; { no warnings 'uninitialized'; for (@unsafe_cache_params){ if (defined $c->{$_} || defined $p->{$_}){ if (ref $c->{$_} eq 'ARRAY' || ref $p->{$_} eq 'ARRAY'){ if (! (@{$c->{$_}} ~~ @{$p->{$_}})){ $self->{cache_safe} = 0; last; } } elsif ($c->{$_} ne $p->{$_}){ $self->{cache_safe} = 0; last; } } } }

All I need to do is verify whether certain portions of the data structure that is the configuration of the last run are the same as this run.


In reply to Is there an is_deeply() outside of Test::More? by stevieb

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.