<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"><<a href="mailto:fobispo@isc.org" target="_blank">fobispo@isc.org</a>></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->model('GUS::WebappSession') as the name.</blockquote><div><br></div><div>So, it was a good suggestion after all ... it didn't work at first, and I think this led me to (maybe) a possible fix</div><div>
<br></div><div>This doesn't work:</div><div><br></div><div><div>sub remove_sessions : Private {</div><div> my ( $self, $c ) = @_; </div><div> $c->delete_expired_sessions;</div><div>}</div></div><div><br></div><div>
And this doesn't either:</div><div><br></div><div><div>sub remove_sessions : Private {</div><div> my ( $self, $c ) = @_; </div><div> my $model = $c->model('GUS::WebappSession');</div><div> my $rs = $model->search( { expires => { '<' , time() } } )->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->model('GUS::WebappSession');</div>
<div> my $rs = $model->search( { expires => { '<' , time() } } );</div><div> while (my $session = $rs->next() ) { </div><div> $session->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'm now moving the discussion to its natural home.</div>
<div><br></div><div>For those interested here'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'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>