Link to home
Start Free TrialLog in
Avatar of zuppy
zuppyFlag for Italy

asked on

Cookie without using something external (ie CGI.pm or something else):

Hi, I've the need to set cookies using perl.
But I've not the possibility to use modules.
ANyone has an idea how to read and write cookies in a script?
(IE to have 2 functions : set_cookie and read_cookie)
Thankyou
Avatar of malec
malec

just put

Set-cookie: <name>=<value>; expires=<date/time> content-type: text/html

followed by 2 blank lines into header;
This will set a cookie <name> to <value>

Retrieve cookie from Environment variable HTTP_COOKIE
Avatar of zuppy

ASKER

can you specify the syntax of:


 expires=<date/time>  (date /time)

and the sintax  of

HTTP_COOKIE ?

Thanks :D
Avatar of ozo
Avatar of zuppy

ASKER

Thanks , so to who I must give points?:D
It's up to you, but I don't mind if you give them to me.
Avatar of zuppy

ASKER

Last question:

in the page specifield by ozo there is the passage
"
expires is an optional attribute. If not specified, the cookie will expire when the user's session ends."

it refers to broswer's session or to OS's sessions?

There is a big difference.
Browser of course.
ASKER CERTIFIED SOLUTION
Avatar of malec
malec

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial