bradcathey has asked for the wisdom of the Perl Monks concerning the following question:
In a CGI::Application ecomm app I'm using CGI::Application::Plugin::Session. When adding an item to the cart:
Code that creates session:
$self->session_config( COOKIE_PARAMS => { -name => 'ECOMM_SESSID', -expires => '+4h', -domain => '.mysite.com', }, SEND_COOKIE => 1 ); CGI::Session->name('ECOMM_SESSID');
A variable dump when viewing the cart shows:
session_id = 123456789 $self->session->param('order_id') = 4321
And the browser Inspector shows:
cookie: ECOMM_SESSID
All good.
The problem comes when calling the next instance script for checking out. In sub cgiapp_prerun, the existence of the order_id is checked. A variable dump when viewing here shows:
session_id = 987654321 <= a different id than above $self->session->param('order_id') = null <= no value
And the browser Inspector shows:
cookie: CGISESSID <== ECOMM_SESSID is missing and instead...
Each time the new instance script is fired, a new session is created. Interestingly, if I return to the cart, all the original values remain.
Bottom line: when firing a new instance script, a new session is started and the cookie is not being written. So, what am I not getting?
(Note: this is similar to Re: Re: Re: Stay aware of security but the proposed solution didn't work
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI::Application::Plugin::Session is creating multiple sessions
by NERDVANA (Priest) on Jul 27, 2023 at 22:23 UTC | |
|
Re: CGI::Application::Plugin::Session is creating multiple sessions
by bradcathey (Prior) on Jul 29, 2023 at 17:42 UTC | |
|
Re: CGI::Application::Plugin::Session is creating multiple sessions
by Anonymous Monk on Jul 27, 2023 at 23:03 UTC |