FAQ

On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo wrote:


Use:

$c->model('GUS::WebappSession') as the name.



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


This doesn't work:


sub remove_sessions : Private {
my ( $self, $c ) = @_;
$c->delete_expired_sessions;
}


And this doesn't either:


sub remove_sessions : Private {
my ( $self, $c ) = @_;
my $model = $c->model('GUS::WebappSession');
my $rs = $model->search( { expires => { '<' , time() } } )->delete;
}


But this workaround did work:


sub remove_sessions : Private {
my ( $self, $c ) = @_;
my $model = $c->model('GUS::WebappSession');
my $rs = $model->search( { expires => { '<' , time() } } );
while (my $session = $rs->next() ) {
$session->delete;
}
}


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.


Whereas when I call delete() on the DBIC::Class::Row? object it works.


Now looking back I guess I should have started all this fuss on the DBIC
mailing list :)


Folks, apologies for the cross-post, but I'm now moving the discussion to
its natural home.


For those interested here's the link to the complete thread:
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg13542.html


And here's the link to the RT ticket
https://rt.cpan.org/Ticket/Display.html?id=81179






--

fernan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20121115/98643db2/attachment.htm

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 9 of 10 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedNov 14, '12 at 12:45p
activeNov 15, '12 at 2:08p
posts10
users3
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase