[Maypole] Problems with sessions

From: Marcello (m.romani at spinsoft.it)
Date: Wed Feb 02 2005 - 20:57:27 GMT


Maybe I'm OT in here, but I have some trouble storing information in the
session slot of the maypole request.
I'm using Maypole::Authentication::UserSessionCookie version 1.4

My app is set up as follows:

<code file="MyApp">
# authentication configuration
###############################
SA::User->require || warn "Couldn't load SA::User class.";
SA->config->{auth}{user_class} = "SA::User";
SA->config->{auth}{user_field} = "username";
SA->config->{auth}{password_field} = "password";
SA->config->{auth}{session_class} = "Apache::Session::MySQL";
SA->config->{auth}{session_args} = {
         DataSource => 'dbi:mysql:sa_sessions',
         UserName => $db_username,
         Password => $db_password,
         LockDataSource => 'dbi:mysql:sa_sessions',
         LockUserName => $db_username,
         LockPassword => $db_password,
};
</code>

User authentication works perfectly.

In Maypole/Model/CDBI.pm I have a "view" method, in which I store a
key/value pair in the current session:

<code>
sub view : Exported {
     my ($self, $r) = @_;
     my $me = $r->objects->[0];
     $r->{session}{constraints}->{$me->table} = $me->id;
     return $self->SUPER::view($r);
}
</code>

The main problem I have is if I call the /view/ method on three tables,
the first key/value pair goes away, i.e. it seems there can be only two
key/value pairs in the "constraints" hash.
An example:
/customer/view/3 -> constraints{customer} == 3
/beer/view/1 -> constraints{beer} == 1
/othertable/view/5 -> constraints{othertable}==5, but the "customer"
entry has gone away!

What do you think ?

Thanks in advance.
Marcello

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT