dstar has asked for the wisdom of the Perl Monks concerning the following question:
And it's not working. Specifically, sessions are not getting invalidated. I'm using the following code in my handler.pl file, taken from the article linked form masonhq:
# Get the incoming cookies my %cookies = parse CGI::Cookie($r->header_in('Cookie')); # Try to re-establish an existing session eval { tie %HTML::Mason::Commands::session, 'Apache::Session::DBI', ($cookies{'AF_SID'} ? $cookies{'AF_SID'}->value() : undef), { DataSource => $dbsource, UserName => $dbuser, Password => $dbpass }; }; # If we could not re-establish an existing # session, create a new session. if ( $@ ) { if ( $@ =~ m/^Object does not exist in the data store/ ) { tie %HTML::Mason::Commands::session, 'Apache::Session::DBI', undef, { DataSource => $dbsource, UserName => $dbuser, Password => $dbpass }; undef $cookies{'AF_SID'}; } } if ( !$cookies{'AF_SID'} ) { my $cookie = new CGI::Cookie(-name => 'AF_SID', -value => $HTML::Mason::Commands::session{_session_i +d}, -path => '/',); $r->header_out('Set-Cookie', => $cookie); } my $status = $ah->handle_request($r); untie %HTML::Mason::Commands::session; return $status;
The problem is it doesn't seem to be talking to the db -- once someone has sucessfully logged in on a particular child, $session{userid} *always* exists even if there's no corresponding row in the db sessions table.
I have to conclude there's something wrong with the way I'm doing it, but since I don't really *understand* how I'm doing it, I don't know what it is.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Session Problems
by eejack (Hermit) on Aug 15, 2001 at 06:39 UTC | |
by dstar (Scribe) on Aug 15, 2001 at 08:51 UTC | |
by eejack (Hermit) on Aug 15, 2001 at 16:02 UTC | |
|
Re: Session Problems
by perrin (Chancellor) on Aug 15, 2001 at 17:57 UTC | |
by Anonymous Monk on Aug 15, 2001 at 19:33 UTC | |
by perrin (Chancellor) on Aug 15, 2001 at 19:50 UTC | |
by dstar (Scribe) on Aug 15, 2001 at 20:13 UTC | |
by perrin (Chancellor) on Aug 15, 2001 at 20:43 UTC | |
| |
|
Re: Session Problems
by drfrog (Deacon) on Aug 15, 2001 at 19:24 UTC | |
|
Found the problem, fixed, uncovered a *worse* one.
by dstar (Scribe) on Aug 16, 2001 at 05:46 UTC |