title: Perl Moose attribute handles set method
body: <p>Defined a HashRef attribute in the lines of 'options' example.</p>
  <pre><code>     has 'clsHsh' =&gt; (
              traits =&gt; ['Hash'],
              is    =&gt; 'rw',
              isa   =&gt; 'HashRef[Str]',
              default =&gt; sub {{}},
              handles =&gt; {
               set_clsHsh =&gt; 'set',
               get_clsHsh =&gt; 'get',
               has_no_clsHsh =&gt; 'is_empty',
               num_clsHsh   =&gt; 'count',
               delete_clsHsh =&gt; 'delete',
               clsHash_pairs =&gt; 'kv',
               },
               );
      
      sub parseCls2()
           {
               my ($self,$line) = @_;
              #input $line format is as follows
              #$line = qq&lt;Class att1=val1 att2=val3.../&gt;)
              #gather all key value pairs sans &lt;Class
              $line =~ s/&lt;Class(.*)\/&gt;/$1/g;
              # split on space and take the resulting array
              # split that on =. Simply equating to hash will convert
              # key1,val1,key2,val2... to hash of key and value.
              my %l4_sh = map {split /=/} split / /,$line;
              $self-&gt;{clsHsh} = \%l4_sh;
              return $self-&gt;{clsHsh};
           }
  # 
  # example of parsing a line
  #
  my $line = qq(&lt;Class Cls=&quot;Bid&quot; description=&quot;bid&quot; low=&quot;&quot; high=&quot;&quot;/&gt;)
  ;
  my $h = $parser-&gt;parseCls2($line);
  my %h1 = %$h;
  while (my ($k,$v) = each %h1) {
    say &quot;key = $k and value = $v&quot;
  }
  </code></pre>
  <p>I am able to populate the clsHsh attribute using a sub that parses $line input parameter and stores the parsed values in the Hash.
  My questions,</p>
  <ol>
  <li>is there a way to repurpose set_clsHsh instead of using a sub?</li>
  <li>What is the recommended way?</li>
  </ol>