Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
laziness, impatience, and hubris
 
PerlMonks  

Can CGI::Cookie be set to never expire?

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

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

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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.