[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] CGI::Application::Plugin::Session woes -- further research


The problem as you may recall, is that a new session is created everytime
my script is being called instead of being reused as needed.  I'm using
the following modules:

CGI::Application                  3.22
CGI::Application::Plugin::DBH     2.00
CGI::Application::Plugin::Session 0.06
CGI::Session                      3.95
DBI                               1.45

I started off with these:

CGI::Session::SQLite              1.00
DBD::SQLite                       1.07

But then I switched to DBD::mysql 2.9003 just to isolate the problem to
one thing at a time.

my first cut looked like this:

sub cgiapp_init
{
  my ($self) = @_;

  ...

  $self->session_config(
    CGI_SESSION_OPTIONS => [ 'driver:MySQL', $self->query,
                             { Handle => $self->dbh } ],
    COOKIE_PARAMS       => {
                            -path    => $self->query->url(-absolute => 1),
                            -expires => '+1y',
                            -secure  => 1.
                           },
   SEND_COOKIE          => 1,
  );
}

This didn't work.  A new session gets created every time.  This on the
other hand does work:

sub cgiapp_init
{
  my ($self) = @_;

  ...

  $self->session_config(
    CGI_SESSION_OPTIONS => [ 'driver:MySQL', $self->query,
                             { Handle => $self->dbh } ],
    COOKIE_PARAMS       => {
                             -domain  => 'localhost',
                             -path    => $self->query->url(-absolute => 1),
                             -expires => '+1y',
                             -secure  => 1.
                           },
   SEND_COOKIE          => 0,
  );

  $self->session_cookie;
  my $cookie = $self->query->cookie(CGISESSID => $self->session->id);
  $self->header_add(-cookie => $cookie );
}

Why?  Is there a bug in my code?  In CGI::Application::Plugin::Session?
Its' documentation?

-- 
Jaldhar H. Vyas <suppressed>

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.