<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 17, 2014 at 7:39 PM, John Stoffel <span dir="ltr">&lt;<a href="mailto:john@stoffel.org" target="_blank">john@stoffel.org</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi all,<br>
<br>
With a bit of nudging, I had a head-smack moment and upgraded to the<br>
latest version of DBIx::Class on CPAN, and it now looks like things<br>
are working better for me, but I&#39;m still getting some interesting<br>
behavior.<br>
<br>
Before I got errors, now I can do:<br>
<br>
   &gt; ../bin/<a href="http://dbic-test.pl" target="_blank">dbic-test.pl</a> Emlen<br>
   DBIx::Class::ResultSet::_construct_results(): Unable to properly collapse has_many results in iterator mode due to order criteria - performed an eager cursor slurp underneath. Consider using -&gt;all() instead at ../bin/<a href="http://dbic-test.pl" target="_blank">dbic-test.pl</a> line 20<br></blockquote><div><br></div><div>Do you have proper non-nullable primary keys set up in all the relevant result classes?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="">   Full Name: Emlen &amp; Howell (8213)<br>
</span>     account_id=5920 boxfolder_id=234  URL: b16f10<br>
     account_id=5921 boxfolder_id=249  URL: b17f10<br>
     account_id=5922 boxfolder_id=281  URL: b19f12<br>
   Full Name: Emlen, Caleb (8214)<br>
     account_id=5923 boxfolder_id=14  URL: b01f14<br>
     account_id=5924 boxfolder_id=50  URL: b04f05<br>
<br>
<br>
So I think I need to change my loop from:<br>
<span class=""><br>
while (my $r = $rs-&gt;next) {<br>
  print &quot;Full Name: &quot;, $r-&gt;full_name, &quot; (&quot;, $r-&gt;name_id, &quot;)\n&quot;;<br>
<br>
  foreach my $a ($r-&gt;account()) {<br>
</span>    print &quot;  account_id=&quot;, $a-&gt;account_id();<br>
    print &quot; boxfolder_id=&quot;,$a-&gt;boxfolder_id(),&quot; &quot;;<br>
<span class="">    my $t = $a-&gt;url();<br>
    $t =~ m/value2=(\w+)\&amp;/;<br>
</span>    print &quot; URL: $1&quot;;<br>
    $vol = $a-&gt;boxfolder-&gt;volume;<br>
    $folder = $a-&gt;boxfolder-&gt;volume;<br>
    $range = $a-&gt;boxfolder-&gt;range;<br>
    print &quot; V=$vol &quot; if defined $vol;<br>
    print &quot; F=$folder &quot; if defined $folder;<br>
    print &quot; R=$range &quot; if defined $range;<br>
<br>
    print &quot;\n&quot;;<br>
  }<br>
}<br>
<br>
<br>
To something more like this:<br>
<br>
   my @r = $rs-&gt;all<br>
   foreach my $r (@r) {<br>
<span class=""></span></blockquote><div><br></div><div>Be aware that this will cost you in terms of memory because you&#39;ll inflate all row objects once. Especially if you prefetch a lot... Depending on your specific result sets, this may not matter to you... But it&#39;s definitely something to be aware of...</div><div><br></div><div>We&#39;ve seen lots of worker processes gobble up 50 - 100 MB of extra memory because of this, so we&#39;ve been converting most uses of foreach my $row ($rs-&gt;all) { ... } to while (my $row = $rs-&gt;next) { ... }. YMMV.</div><div><br></div><div>/L</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">     print &quot;Full Name: &quot;, $r-&gt;full_name, &quot; (&quot;, $r-&gt;name_id, &quot;)\n&quot;;<br>
<br>
     foreach my $a ($r-&gt;account()) {<br>
</span>       print &quot;  account_id=&quot;, $a-&gt;account_id();<br>
       print &quot; boxfolder_id=&quot;,$a-&gt;boxfolder_id(),&quot; &quot;;<br>
<span class="">       my $t = $a-&gt;url();<br>
       $t =~ m/value2=(\w+)\&amp;/;<br>
</span>       print &quot; URL: $1&quot;;<br>
       $vol = $a-&gt;boxfolder-&gt;volume;<br>
       $folder = $a-&gt;boxfolder-&gt;volume;<br>
       $range = $a-&gt;boxfolder-&gt;range;<br>
       print &quot; V=$vol &quot; if defined $vol;<br>
       print &quot; F=$folder &quot; if defined $folder;<br>
       print &quot; R=$range &quot; if defined $range;<br>
<br>
       print &quot;\n&quot;;<br>
     }<br>
   }<br>
<br>
And that does seem to do the trick.  Now to move onto updating my<br>
Dancer web interface and see if I&#39;m getting proper data out (or that I<br>
even have proper data IN!) of the DB and displayed nicely for the end<br>
users.<br>
<br>
Thanks for the help, I feel a little dumb for not thinking to upgrade right off the bat.<br>
<br>
Cheers,<br>
John<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
List: <a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class" target="_blank">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class</a><br>
IRC: <a href="http://irc.perl.org#dbix-class" target="_blank">irc.perl.org#dbix-class</a><br>
SVN: <a href="http://dev.catalyst.perl.org/repos/bast/DBIx-Class/" target="_blank">http://dev.catalyst.perl.org/repos/bast/DBIx-Class/</a><br>
Searchable Archive: <a href="http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk" target="_blank">http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk</a><br>
</div></div></blockquote></div></div></div>