perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Schroeder" <wschr...@schroedernet.net>
Subject session question
Date Thu, 09 Dec 2004 15:22:13 GMT

I have used embperl with great success in a number of projects but I
have never needed to keep session information until now and I find
myself a little confused.
Here is the dilemma: I can insert session info into mysql but I am not
sure how to go about restoring session data.
I have a form that has two radio buttons 1: Have a login 2: Need a
login. If the user submits "need" a form opens that accepts a username
and a PIN. After submitting that information I move the user through a
few quiz questions save the data and exit. The %udat works great when
the app is used this way. The problem I have is restoring session data
when I open new pages. The $udat{_session_id} prints out the session
number yet I can not get $udat{User}.
I have a feeling that I need the $r - GetSession somehow but when I use
that [- $r -> GetSession -] I get a
"Can't call method "GetSession" on an undefined value" error.
What do I need to do here???
I have attached the main form and inlined some other relevent snippets.
BTW: when I get this to work I will be more that happy to fully document
what I did post it back here.
Apache 1.3.33, embperl 1.3.6, mod_perl 1.2.9, apache::session 1.6,
apache::sessionX 2.00b5
The Trying to restore session page:
[- use Apache::Session::MySQL; -]
[- use Apache; -]
[- use DBI; -]
[- $req = shift; -]
[- $r -> GetSession; -]
<p> [+ $udat{_session_id} +]</p>
<p> [+ $udat{Token} +]</p>
[- $cookie = $udat{_session_id}; -]

[-  my %session; -]
[- tie %session, 'Apache::Session::MySQL', $cookie, {
      DataSource => 'dbi:mysql:sessions', #these arguments are
      UserName   => 'sessions',         #required when using
      Password   => 'sessions',           #MySQL.pm
      LockDataSource => 'dbi:mysql:sessions',
      LockUserName   => 'sessions',
      LockPassword   => 'sessions'
}; -]
####################################################
httpd.conf options
<Directory "/usr/local/apache/htdocs/">
        PerlSetEnv EMBPERL_OBJECT_BASE base.epl
        PerlSetEnv EMBPERL_OBJECT_APPNAME infosec
        PerlSetEnv EMBPERL_ESCMODE 0
        #PerlSetEnv EMBPERL_OPTIONS 262144
        PerlSetEnv EMBPERL_OBJECT_OPTIONS 16
        #PerlSetEnv EMBPERL_DEBUG 2097152
        #PerlSetEnv EMBPERL_LOG "/tmp/embperl.log"
        PerlSetEnv EMBPERL_SESSION_ARGS
"DataSource=dbi:mysql:session;hostname=localhost UserName=sessions
Password=password"
        PerlSetEnv EMBPERL_SESSION_CLASSES "MySQL Semaphore"
        PerlSetEnv EMBPERL_OBJECT_FALLBACK xerror.html



Notice: This e-mail and any attachments are confidential
and may be subject to legal or some other professional
privilege. They are intended solely for the attention and
use of the named addressee(s). They must not be disclosed
to any person without authorisation.

This e-mail and any attachments are also subject to
copyright. They may only be copied or distributed with
the consent of the copyright owner. If you are not
named addressee you must not use, disclose, retain or
reproduce all or any part of the information contained
in this e-mail or any attachments.
Mime
View raw message