if the $c's were strings, you would just need to swap these round:

print "Content-Type: text/html\n\n"; print "Set-Cookie: $c1,$c2,$c3\n";

And break the Set-Cookie into three separate lines of one cookie, with a single \n on the end of each one.

(The two \n's signify the end of the header, so the Set-Cookie isn't being obeyed. it's presumably appearing on the page.)

But your $c1, $c2 etc are objects and will just print memory-address gibberish in this form. You need to use CGI.pm's header method: it'll send them right, and take care of those minor formatting issues too.

update: OEMike is right and i am a fule. CGI::Cookies are string context overloaded (?terminology) and will print nicely the way he called them. and they can be concatenated after all, but with a semicolon, not a comma as he had it. sorry bout that. must.... read... docs...


In reply to Re: CGI::Cookie by thpfft
in thread CGI::Cookie by OEMike

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.