Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: cookies n variables

by TexasTess (Beadle)
on Nov 15, 2002 at 12:54 UTC ( [id://213133]=note: print w/replies, xml ) Need Help??


in reply to cookies n variables

I used cookies recently in a project to maintain state and store values between accesses and it worked rather well for me HOWEVER, I found the CGI::Cookie routine to be rather useless for my purposes as it is difficult to mix CGI.pm with other code that is not OO and most of mine was pure long hand. So, if you find that you have problems with the header timing you can use a javascript that writes your cookie in a blank html page that has a refresh rate set to 1. The page is written by the perl script and only appears for a brief second but performs the job marvelously. There are many examples available that illustrate how to break up cookie data easy enough once it's been written in either java or perl so you should not have a problem....
if ($ENV{'HTTP_COOKIE'}) { @cookies = split (/; /, $ENV{'HTTP_COOKIE'}); foreach $cookie (@cookies) { ($name, $value) = split (/=/, $cookie); $cookie_hash{$name} = $value; } }
Google it, you'll find a ton of examples...

TexasTess
"Great Spirits Often Encounter Violent Opposition From Mediocre Minds" --Albert Einstein

Replies are listed 'Best First'.
Re: Re: cookies n variables
by thraxil (Prior) on Nov 15, 2002 at 16:46 UTC

    how, exactly, is CGI.pm difficult to use with non-OO code? that doesn't make any sense to me.

    what is the problem you are referring to with header timing? i've been doing CGI programming and using cookies for years now and have never encountered a problem like that.

    finally, i really would strongly recommend not trying to reinvent the wheel and write your own cookie parser. CGI.pm does the job just fine and should be easier to read. see use CGI or die; for more on that.

    anders pearson

Re: Re: cookies n variables
by CukiMnstr (Deacon) on Nov 15, 2002 at 18:38 UTC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-26 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found