Perl CGI  «Prev  Next»

Lesson 12Clearing cookies
ObjectiveIdentify the steps involved in clearing a cookie

Clearing Cookies in Perl


Set cookie: UserID=007; Expires=Mon, 01-Jan-1990 00:00:00 GMT

In RFC-2109 cookies, you set the Max-Age value to zero:
Set cookie: UserID=007; Max-Age=0; Version=1

This does not work in the current beta of Netscape 4. As of this writing, RFC-2109 is still being debated by the members of the Internet Engineering Task Force, HTTP Working Group. For that reason, all the examples in this module use the Netscape cookies which are supported by a large number of browsers currently available.

Cookie example

ClearPerl - Cookie - Exercise