[Catalyst] Session::Store::DBIC and session table (postgres)

Fernan Aguero fernan.aguero at gmail.com
Thu Nov 15 13:31:21 GMT 2012

On Wed, Nov 14, 2012 at 5:56 PM, Francisco Obispo <fobispo at isc.org> 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 ) =3D @_;

And this doesn't either:

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

But this workaround did work:

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

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:

And here's the link to the RT ticket

-- =

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

More information about the Catalyst mailing list