Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Re: Re: Cookie Hell

by TexasTess (Beadle)
on Jul 07, 2002 at 01:19 UTC ( #179915=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Cookie Hell
in thread Cookie Hell

The meat of the program is working like a charm and does not use To convert it would mean days and days of work that I don't have time for...I agree that is very cool, but we didn't get it approved for installation until I'd gotten most of the project working.

I hate to think that I can get a database flatfile script to work....XORing passwords and validating entries without but can't get a simple cookie to set ?


Replies are listed 'Best First'.
Re: Re: Re: Re: Cookie Hell
by zaimoni (Beadle) on Jul 07, 2002 at 04:21 UTC

    While red tape is uncool, we're stuck with the current state of affairs. One strategy is printing set-cookie headers, like this:

    Set-Cookie: VarName=Value;path=/;

    Of course, this does absolutely nothing in the way of fine details like escaping values, etc. (The CGI module does all of this automatically when used correctly.) Escaping variable names is particularly unstable: I've seen cases where different versions of IE/NS had different ideas about whether to stomp underscores in variable names before sending them.

    Another idea to consider is a very minimal use of the CGI module. That is: refactor the acquisition of variable/cookie names and values, and use print $q->header and its variants, and $VarName = $q->cookie(...) to properly construct the cookies...but leave all generation of HTML proper as-is (print to STDOUT is typical). I personally am accustomed to editing HTML in a programming file editor rather than a GUI environment, so I have no immediate pressure to use any of the HTML-generating shortcuts.

Re^4: Cookie Hell
by Aristotle (Chancellor) on Jul 07, 2002 at 13:05 UTC
    While this isn't very constructive, I have to doubt the fact that it works like a charm. How unusual are the queries you've hit it with? Will it work for both GET and POST requests? What about multipart/form-data? Does it gracefully handle multiple query keys? That's just the most common problems I can think of off the top of my head. See Ovid's excellent CGI course for good - nay, required - practice when writing CGI scripts.

    Makeshifts last the longest.

      Well, I solved the issue today at work, one problem was that I realised I had the wrong day of the week listed for the date/year combo in the expires list.

      Another step I took was to remove the arbitrary &print_headers call that occurred at the beginning of the script and place it within subs that would require a header to print

      Then I had to play with the path a bit...I don't have admin a systems engineer doing software engineering for my boss as a "freebie" a result my code is outside of the cgi-bin and my paths are all over the damn place until the program goes prime time..thus the path=/ option had to be massaged a bit ...

      "Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Einstein
Re4: Cookie Hell
by blakem (Monsignor) on Jul 07, 2002 at 03:36 UTC
    Do you mind if I ask what version of perl you're using? I seem to remember being added to the core distribution somewhere around 5.004, which was like 5 years ago. Any reasonably recent distribution of perl should already come with installed....


      I'll have to's 5.something...and it might have been "installed" but it wasn't functional...don't ask why..I don't have admin rights on the server all I know is it didn't work...then all of a sudden it appeared after I cried enough..and it started working :-)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://179915]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2023-09-26 21:41 GMT
Find Nodes?
    Voting Booth?

    No recent polls found