Hello,<div><br></div><div>I am trying to make something work nice, but it doesn&#39;t want to =) Probably, it&#39;s just by design, or I am missing something.</div><div><br></div><div>I have text column in DB used to store everything not fit into row initially. To do this - I am storing serialized hash in JSON format.</div>

<div><br></div><div>In Result class I have something like this:</div><div><br></div><div><div>__PACKAGE__-&gt;table(&quot;users&quot;);</div><div>__PACKAGE__-&gt;add_columns(</div><div> [...]</div><div>  &quot;data&quot;,</div>

<div>  {</div><div>    data_type =&gt; &quot;TEXT&quot;,</div><div>    default_value =&gt; undef,</div><div>    is_nullable =&gt; 1,</div><div>    size =&gt; 65535,</div><div>  },</div><div>);</div><div><br></div><div><div>

use JSON::XS;</div><div>use Hash::AsObject;</div><div><br></div></div><div>__PACKAGE__-&gt;inflate_column(</div><div>    &#39;data&#39;,</div><div>    {</div><div>      inflate =&gt; sub {</div><div>        Hash::AsObject-&gt;new(decode_json( shift() ))</div>

<div>      },</div><div>      deflate =&gt; sub {</div><div>        encode_json shift</div><div>      },</div><div>    },</div><div>);</div><div><br></div><div><br></div><div>It works well for retrieving values from DB:</div>

<div>$test = $user-&gt;data-&gt;{test}; # return 1</div><div><br></div><div>But to save data in db I want to do following:</div><div>$user-&gt;data-&gt;{test} = 1;</div><div>$user-&gt;update();</div><div><br></div><div>This doesn&#39;t work. It successfully assign 1 to $user-&gt;data-&gt;{test}, but it never passes to deflator and never stores in the DB.</div>

<div><br></div><div>But in the same time this works without any problems:</div><div>$user-&gt;data({ &#39;test&#39; =&gt; 1 });</div><div>$user-&gt;update;</div><div><br></div><div><br></div><div>Question: is it possible to make it work with $user-&gt;data-&gt;{test} = 1; notation? I.e. I do not want to create new methods in results class, not want to extract hash from field first and then save it?</div>

<br>Regards,<br>Pavel <br><br>
</div>