<div class="gmail_quote">On Wed, Jun 10, 2009 at 12:15 PM, Jonathan Otsuka <span dir="ltr">&lt;<a href="mailto:djgoku@gmail.com">djgoku@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div style=""><span style="font-family: Times;"><div><div> $c-&gt;stash-&gt;{stuff} = [</div><div>        $c-&gt;model(&#39;DB::Blah&#39;)-&gt;search(</div><div>            {},</div><div>            { select =&gt; [&#39;data&#39;, { count =&gt; &#39;data&#39; }], group_by =&gt; [&#39;data &#39;] }</div>
<div>        )</div><div>    ];</div></div></span></div></blockquote><div><br>You want <a href="http://search.cpan.org/%7Eribasushi/DBIx-Class-0.08104/lib/DBIx/Class/ResultSet.pm#as">the &quot;as&quot; attribute</a> on your query:<br>
</div><div><br> <span style="font-family: courier new,monospace;">$c-&gt;model(&#39;DB::Blah&#39;)-&gt;search(</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    {},</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    { select   =&gt; [ &#39;data&#39;, { count =&gt; &#39;data&#39; } ],</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">      as       =&gt; [ &#39;data&#39;, &#39;cnt&#39; ],</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">      group_by =&gt; [ &#39;data&#39; ],</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    },</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">);</span><br style="font-family: courier new,monospace;"><br>And then:<br><br><span style="font-family: courier new,monospace;">$rec-&gt;data;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">$rec-&gt;get_column(&#39;cnt&#39;);</span><br style="font-family: courier new,monospace;"><br>Note the necessity of using get_column here, since &quot;cnt&quot; is not an actual table column and thus won&#39;t have an auto-generated accessor method.<br>
</div></div><br>-- <br>Stephen Clouse &lt;<a href="mailto:stephenclouse@gmail.com">stephenclouse@gmail.com</a>&gt;<br>