[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: 'Apache::Session' using REMOTE_USER as key
From:       Perrin Harkins <perrin () elem ! com>
Date:       2002-05-31 20:53:21
[Download RAW message or body]

Brian Parker wrote:
>    my $rm = $ENV{REMOTE_USER}
>    eval{
>       # see if the user has a session created
>       tie %session, 'WC::ApacheSession::MySQL', $rm, {
>           Handle     => $dbh,
>           LockHandle => $dbh
>       };
>       1;
>    } or do {
>       # create the session using $ENV{REMOTE_USER} as key
>       tie %session, 'WC::ApacheSession::MySQL', undef, {
>           Handle     => $dbh,
>           LockHandle => $dbh
>       };
>    };

Be careful, many other things could go wrong in that first eval (no 
database running, incorrect password, etc.).  You'd be better off 
checking $@ and only doing the next part if you see that it's an error 
about the session not existing yet.

You could also just hack it a little to avoid this issue, probably by 
changing Apache::Session::Store code.

- Perrin

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic