Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Can CGI::Cookie be set to never expire?

by rsiedl (Friar)
on Nov 16, 2004 at 14:14 UTC ( [id://408113]=perlquestion: print w/replies, xml ) Need Help??

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

Hi Monks,

Basically the title says it all.
Is it possible to set the "expire" attribute of CGI::Cookie to never?

Cheers,
Reagen
  • Comment on Can CGI::Cookie be set to never expire?

Replies are listed 'Best First'.
Re: Can CGI::Cookie be set to never expire?
by matthewb (Curate) on Nov 16, 2004 at 14:17 UTC

    You could set the expiry date to ten years in the future but what if the user deletes all their cookies for some reason?

    In practice the answer is, "not in any way you can count on".


    MB
      ok. Thanks MB.
Re: Can CGI::Cookie be set to never expire?
by bart (Canon) on Nov 16, 2004 at 14:37 UTC
    I don't think so, I don't think the cookie header command set includes that option — though you can set the expires field a very long time into the future. (Pass a formatted date instead of an maximum age, it'll just use it.)

    Why do you want it, anyway? Do you expect people to still be using the same computer and browser, in 10 years time? Do you still expect to recognize them when they come back for the first time, after your cookie has expired, years from now? Does it even matter?

    For people that frequent your site often enough, I'd simply refresh the cookie once in a while. That way, for regular visitors, the cookie will effectively never expire.

Re: Can CGI::Cookie be set to never expire?
by borisz (Canon) on Nov 16, 2004 at 14:21 UTC
    Set expire to a high value
    ... -expires => '+99y', ...
    Boris

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found