You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Gerardo Schimpf <sc...@bibleinfo.com> on 2002/11/19 16:38:12 UTC

Sessions...

Hello, I'm trying to use Sessions in embperl. I'm trying to see what is in the 
%session hash, more spesific i'm triying to print out the session_id 
($session[_session_id]).
My question is, how can I print out the session value?

Thanks in advance....

My structure in the Mysql database (sessions table) is the following:


field               type                      null 
-------------    --------                  -------------------------
id                  int(3)                      no   auto_increment
a_session      varchar(255)           yes

and this is my code:

[-

use Apache::Session::MySQL;

my $cookie=undef;
my %session;

tie %session, "Apache::Session::MySQL", $cookie,  {
      DataSource => 'dbi:mysql:database;host=host', #these arguments are
      UserName   => 'username',         #required when using
      Password   => 'password',           #MySQL.pm
      LockDataSource => 'dbi:mysql:database;host=host',
      LockUserName   => 'username',
      LockPassword   => 'password'
                                 };
-]

[+ $session[_session_id] +]


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Sessions...

Posted by "Luiz Fernando B. Ribeiro" <lu...@engenhosolucoes.com.br>.
Em Tue, 19 Nov 2002 15:38:12 +0000
Gerardo Schimpf <sc...@bibleinfo.com> escreveu:

> Hello, I'm trying to use Sessions in embperl. I'm trying to see what
> is in the %session hash, more spesific i'm triying to print out the
> session_id ($session[_session_id]).
> My question is, how can I print out the session value?
> 
> Thanks in advance....
> 
> My structure in the Mysql database (sessions table) is the following:
> 
> 
> field               type                      null 
> -------------    --------                  -------------------------
> id                  int(3)                      no   auto_increment
> a_session      varchar(255)           yes
> 
> and this is my code:
> 
> [-
> 
> use Apache::Session::MySQL;
> 
> my $cookie=undef;
> my %session;
> 
> tie %session, "Apache::Session::MySQL", $cookie,  {
>       DataSource => 'dbi:mysql:database;host=host', #these arguments
>       are UserName   => 'username',         #required when using
>       Password   => 'password',           #MySQL.pm
>       LockDataSource => 'dbi:mysql:database;host=host',
>       LockUserName   => 'username',
>       LockPassword   => 'password'
>                                  };
> -]
> 
> [+ $session[_session_id] +]
> 

Hi,

Setup session in the "Embperl way". Your setup should be in your
httpd.conf and in your html files just use the %udat hash provided
by Embperl. 

Read the man pages: 
  perldoc HTML::Emperl
  perldoc HTML::EmperlObject
  perldoc Apache::Session::Store::MySQL

The 'session_id' is accessed with [+ $udat{_session_id} +]

Regards,

Luiz Fernando B. Ribeiro
Engenho Soluções para a Internet


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org