title: Can I use smart matching, ~~, in Test::More's cmp_ok?
body: <p>I am testing a function that returns an array. The array could be different depending on the environment but it will always have at least one constant value (the one that I want to test).</p>
  
  <p>As I am using Perl 5.12, I can use the smartmatch operator to find if the element is in the array:</p>
  
  <pre><code>ok($known_value ~~ @returned, 'testing method abc')
  </code></pre>
  
  <p>But I like the enhanced output of <code>is</code> and <code>like</code> with the "found" and "expected" parts. So I tried this:</p>
  
  <pre><code>cmp_ok($known_value, '~~', @returned, 'testing method abc')
  </code></pre>
  
  <p>This does not work because it seems that <code>cmp_ok</code> expects a scalar in both parts of the comparison:  </p>
  
  <pre><code>not ok 1 - testing method abc
  #   Failed test 'testing method abc'
  #   at abc.t line 53.
  #     'stable_value'
  #         ~~
  #     '2'
  </code></pre>
  
  <p>The array in the "expected" slot is evaluated in scalar context and converted to 2.</p>
  
  <p>I can work around this with a hack using <code>like</code> and stringifying the array, but having a test where you can use the smartmatch operator as a comparison method (like <code>when</code>) would be nice. Is there a way to do this with Test::More or some other module?</p>
  
  <p>At the moment I am using:</p>
  
  <pre><code>ok($known_value ~~ @returned, 'testing method abc')
    or diag (
        "ERROR:\n".
        "Found: ". Dumper @returned."\n".
        "Expected at least one element equal to '$known_value'"
    )
  </code></pre>
  
  <p>Is this the best that I can do?</p>