title: How to access the attributes of a class indirectly
body: <p>This is similar to, but not quite the same as another of my questions: <a href="https://stackoverflow.com/questions/59520029/content-checking-some-not-all-class-attributes">Content checking some, not all, class attributes</a></p>
  <p>I am writing a test to verify the effect of processing on a object. But I can't work out how to get the value of a known set of the object's attributes but test with the same code. Something like the following (which does not work):</p>
  <pre><code>class A { has $.a, has $.b, has $.c };
  my A $v .=new(:1a, :2b);
  
  for &lt;a b&gt; { ok $v.{$_} &gt; 0 }; # this does not work, but illustrates the intent.
  </code></pre>
  <p>If instead of an object I had used a Hash, then it is easy to get values from the Hash knowing the keys.</p>
  <p>At the moment all I can think of is to test each attribute:</p>
  <pre><code>ok $v.a &gt; 0;
  ok $v.b &gt; 0;
  </code></pre>
  <p>In addition, I don't want to look at ALL the attributes of the object, which is what .^attributes gives me, only some of them.</p>