damian has asked for the wisdom of the Perl Monks concerning the following question:

hi guys, is there a posibility to append to a saved cookie. example i already saved cookie data and i want to append to that saved cookie. the script should append cookie data everytime you run the script. thanks

Replies are listed 'Best First'.
Re: appending to cookie
by doran (Deacon) on Sep 27, 2000 at 07:21 UTC
    I'm assuming you're following the rules regarding cookies.

    If all you want to do is add to an existing cookie, it's probably easiest to:

    1. Read the existing cookie data into a variable.
    2. Add (concatenate) the new data to the variable.
    3. Rewrite the cookie, now with the added data in the variable.

    If the new, updated cookie has the same name as an existing cookie, it'll just overwrite it.

    Good luck, db
(jcwren) Re: appending to cookie
by jcwren (Prior) on Sep 27, 2000 at 06:33 UTC
    Cookies are limited to a certain maximum length, which is 4K. Once you write past the 4K limit, the browser will not recognize any more information in the cookie. I don't know what the HTTP::Cookie module will do, in that case. If it meets spec, it will truncate your cookie data to 4K. CookieCentral has some good information on this.

    --Chris

    e-mail jcwren