I'm attempting to set multiple cookies using CGI::Application, this is running under mod_perl.

sub do_login { my $self = shift ; my $q = $self->query ; my $c1 = $q->cookie(-name=>'userID', -value=>'test123', ); my $c2 = $q->cookie(-name=>'sessionID', -value=>'blahblahblah', ); $self->header_type('header'); $self->header_props(-type=>'text/plain', -cookie=> [$c1,$c2], ); }

The problem is that only the last cookie in the array (in this case $c2) gets set. If I swap them to:

$self->header_props(-type=>'text/plain', -cookie=> [$c2,$c1], );

Then only $c1 is set. Finally :

$self->header_props(-type=>'text/plain', -cookie=> [$c2,$c1,$c2], );

Sets only $c2.

header_props() returns a hash with the attributes set. I've checked this and everything _seems_ to be fine. However if I pass this to the header() method from CGI, I get an '', which I think indicates something is wrong:(

The same script under 'traditional' cgi (no mod_perl) works fine

Any help would be much appricated, as I'm sure its something really simple I've missed


In reply to Multiple Cookies with CGI::Application by Nomis52

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.