开发者

How to test if a Perl CGI::Cookie cookie is almost about to expire?

If th开发者_开发百科e cookie is between 0 and x minutes away from expiration, I would like to refresh the expires value of that cookie to some set value (if the cookie is already expired, I do not want to refresh it).

How would I accomplish this with CGI::Cookie and CGI.pm?


Cookies sent by the browser do not expose their expiration time; they are either sent or they aren't. To know when it is going to expire, you have to store the expiration time in the cookie value in some parseable form.


If the cookie has been set, then it will be sent to the server. If it has expired, then it won't be.

Just test to see if the cookie exists, and refresh it if it exists.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜