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

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

In reply to CGI::Application::Plugin::Session is creating multiple sessions by bradcathey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.