<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo <span dir="ltr">&lt;<a href="mailto:fobispo@isc.org" target="_blank">fobispo@isc.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Use:<br>
<br>
$c-&gt;model(&#39;GUS::WebappSession&#39;) as the name.</blockquote><div><br></div><div>So, it was a good suggestion after all ... it didn&#39;t work at first, and I think this led me to (maybe) a possible fix</div><div>

<br></div><div>This doesn&#39;t work:</div><div><br></div><div><div>sub remove_sessions : Private {</div><div>  my ( $self, $c ) = @_; </div><div>  $c-&gt;delete_expired_sessions;</div><div>}</div></div><div><br></div><div>

And this doesn&#39;t either:</div><div><br></div><div><div>sub remove_sessions : Private {</div><div>  my ( $self, $c ) = @_; </div><div>  my $model = $c-&gt;model(&#39;GUS::WebappSession&#39;);</div><div>  my $rs = $model-&gt;search(  { expires =&gt; { &#39;&lt;&#39; , time() } } )-&gt;delete;</div>

<div>}</div></div><div><br></div><div>But this workaround did work:</div><div><br></div><div><div>sub remove_sessions : Private {</div><div>  my ( $self, $c ) = @_; </div><div>  my $model = $c-&gt;model(&#39;GUS::WebappSession&#39;);</div>

<div>  my $rs = $model-&gt;search(  { expires =&gt; { &#39;&lt;&#39; , time() } } );</div><div>  while (my $session = $rs-&gt;next() ) { </div><div>    $session-&gt;delete;<br></div><div>  }</div><div>}</div></div><div><br>

</div><div>So, apparently the problem is calling delete() right on the resultset object. For some reason that eludes me, DBIC is not fully qualifying the table in this case.</div><div><br></div><div>Whereas when I call delete() on the DBIC::Class::Row? object it works. </div>

<div><br></div><div>Now looking back I guess I should have started all this fuss on the DBIC mailing list :)</div><div><br></div><div>Folks, apologies for the cross-post, but I&#39;m now moving the discussion to its natural home.</div>

<div><br></div><div>For those interested here&#39;s the link to the complete thread:</div><div><a href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg13542.html">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg13542.html</a><br>

</div><div><br></div><div>And here&#39;s the link to the RT ticket</div><div><a href="https://rt.cpan.org/Ticket/Display.html?id=81179">https://rt.cpan.org/Ticket/Display.html?id=81179</a><br></div><div><br></div><div><br>

</div><div><br></div></div>-- <br>fernan<br>
</div>