8.36. CGI::CookieProvides an interface to Netscape (HTTP/1.1) cookies that can be used in conjunction with CGI.pm or independently. To use CGI::Cookie, create a new cookie object with the constructor new. You can then send the cookie to the browser in one of the following ways:
$c = new CGI::Cookie(attribs) Constructor. Creates a new cookie. Attributes are:
$c->as_string Turns internal representation of cookie into RFC-compliant text. Called internally by overloading the "" operator, or can be called directly.
$c->domain(val) Gets or sets the cookie's domain. With no parameter, gets the current value; otherwise, sets the new value.
$c->expires(val) Gets or sets the cookie's expiration date. With no parameter, gets the current expiration date; otherwise, sets the new value.
%cookies = fetch CGI::Cookie Returns a hash containing cookies returned by the browser, in which the keys are the cookie names and the values are the cookie values. In a scalar context, fetch returns a hash reference.
$c->name(val) Gets or sets the cookie's name. With no parameter, returns the current name; otherwise, sets the new value.
%cookies = parse CGI::Cookie(stored_cookies) Retrieves cookies stored in an external form.
$c->path(val) Gets or sets the cookie's path. With no parameter, returns the current path; otherwise, sets the new value.
%cookies = raw_fetch CGI::Cookie Like fetch, but does no unescaping of reserved characters; useful for retrieving cookies set by a foreign server.
$c->value(val) Gets or sets the cookie's value. With no parameter, returns the current value; otherwise, sets the new value. In array context, returns the current value as an array. In scalar context, returns the first value of a multivalued cookie. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|