title: Is the truthiness of a dualvar always that of its string part?
body: <p>The empirical behaviour of my Perl 5.26.2 x64 (Cygwin) is that a dualvar is truthy if and only if its <em>string</em> part is truthy:</p>
  
  <pre><code># Falsy number, truthy string =&gt; truthy
  $ perl -MScalar::Util=dualvar -E 'my $v=dualvar 0, "foo"; say "yes" if $v'
  yes
  
  # Truthy number, falsy string =&gt; falsy
  $ perl -MScalar::Util=dualvar -E 'my $v=dualvar 1, ""; say "yes" if $v'
  
  # Truthy number, truthy string =&gt; truthy
  $ perl -MScalar::Util=dualvar -E 'my $v=dualvar 1, "foo"; say "yes" if $v'
  yes
  
  # Falsy number, falsy string =&gt; falsy
  $ perl -MScalar::Util=dualvar -E 'my $v=dualvar 0, ""; say "yes" if $v'
  </code></pre>
  
  <p>This has been the case since 2009 per <a href="https://github.com/EndPointCorp/end-point-blog/issues/190#issuecomment-343620618" rel="noreferrer">this</a>.</p>
  
  <p><strong>Question:</strong> Is this guaranteed behaviour?</p>
  
  <ul>
  <li><p><a href="https://metacpan.org/pod/Boolean::String" rel="noreferrer"><code>Boolean::String</code></a> says that this is the behaviour.  However, I don't know if that's something I can rely on, in terms of backward compatibility. 
  I also do not see an express statement in <a href="http://perldoc.perl.org/perlsyn.html#Truth-and-Falsehood" rel="noreferrer">perlsyn</a>, <a href="https://metacpan.org/pod/Scalar::Util#dualvar" rel="noreferrer"><code>Scalar::Util</code></a>, or <a href="http://perldoc.perl.org/perldata.html#Context" rel="noreferrer"><code>perldata#Context</code></a>.</p></li>
  <li><p>I do see the following in <a href="http://perldoc.perl.org/perldata.html#Scalar-values" rel="noreferrer"><code>perldata#Scalar-values</code></a>:</p>
  
  <blockquote>
    <p>A scalar value is interpreted as FALSE in the Boolean sense if it is undefined, the null string or the number 0 (or its string equivalent, "0"), and TRUE if it is anything else. The Boolean context is just a special kind of scalar context where no conversion to a string or a number is ever performed.</p>
  </blockquote>
  
  <p>The statement that "no conversion ... is ever performed" unfortunately doesn't tell me which part(s) of a dualvar the interpreter is looking at!  </p></li>
  <li><p>Similarly, Chas. Owens's <a href="https://stackoverflow.com/a/3914490/2877364">related answer</a> says that </p>
  
  <blockquote>
    <p>the truthiness test looks at strings first</p>
  </blockquote>
  
  <p>But if it looks at strings <em>first</em>, what does it look at <em>second</em>, and when?</p></li>
  </ul>
  
  <p><strong>Edit</strong> My understanding is that if <a href="https://metacpan.org/pod/overload" rel="noreferrer"><code>overload</code></a> is defined on a variable, dualvar or not, the <code>bool</code> overload will control.  I am wondering about the non-overloaded case.</p>
  
  <p><strong>Edit 2</strong> ikegami's answer <a href="https://stackoverflow.com/a/13520547/2877364">here</a> points out that <code>PL_sv_yes</code> and <code>PL_sv_no</code> <em>also</em> have an <code>NV</code> (<code>double</code>) component.  For bonus points :) , does the NV have any effect on truthiness if a dualvar has one?  (Let me know if that answer is actually involved enough to deserve a separate question.)</p>