Provides an interface to Netscape (HTTP/1.1) cookies that can be used
in conjunction with
CGI.pm or independently. To use
CGI::Cookie, you create a new cookie object with the constructor
new
.
You can then send the cookie to the browser in one of the following ways:
-
From a CGI script, create a Set-Cookie field in the HTTP header for each
cookie you want to send (
$c
is the cookie object):
print "Set-Cookie: $c0";
-
With CGI.pm (see
Chapter 10
), use the
header
method with a
-cookie
argument:
print header(-cookie=>$c);
-
Using
mod_perl
(see
Chapter 11,
Web Server Programming with mod_perl
), use the request object's
header_out
method:
$r->header_out('Set-Cookie',$c);
The following methods are provided for CGI::Cookie: