NCCI Perl Documentation HttpCookie(3)
NAME
HttpCookie - Management Class for HTTP Protocol Persistent
Cookies
SYNOPSIS
# Access to modules (see the NOTES section for setup)
BEGIN {
...
push (@INC, "../sys/csbase/lib");
...
}
use HttpCookie;
$cookie = new HttpCookie;
DESCRIPTION
This Perl module provides access to the HTTP protocol's
persistent cookie facility. Persistent cookies are a way of
maintaining state in a web-based application. The cookies
store informatin on the browser client. It does this by
accepting a Set-Cookie header from a CGI program, and
passing that information back to the CGI using the
HTTP_COOKIE environment variable.
FUNCTIONS
HttpCookie->new()
Build a new HttpCookie object, based on the HTTP_COOKIE
environment variable in the perl global hash %ENV (that
is, based on $ENV{"HTTP_COOKIE"}).
HttpCookie->new($env_vars)
Given a REFERENCE to a perl hash containing an entry for
HTTP_COOKIE, build a new HttpCookie object based on the
value of $env_vars->{"HTTP_COOKIE"}.
get($cookieKey)
Return the value of the cookie whose name is $cookieKey.
Any URL encodings in the value of the cookie have been
decoded.
getRaw($cookieKey)
Return the value of the cookie whose name is $cookieKey.
Any URL encodings in the value of the cookie have NOT
been decoded.
setCookieText($key, $value, [$expires], [$path], [$domain])
Return a string which, when sent as part of the header
of a HTTP response, sets a given cookie to a given
value. Any supplied expiration, path, and domain
arguments are assembled into the returned string, as
11/May/99 Last change: perl 5.004, patch 01 1
NCCI Perl Documentation HttpCookie(3)
appropriate. The $value is typically URL-encoded as
necessary.
NOTE that THE RETURNED STRING MUST BE WRITTEN TO THE
HTTP OUTPUT STREAM, PRIOR TO ANY Content-Type
SPECIFICATIONS.
cookieHash()
Return a reference to a hash of the persistent cookies.
Any URL encodings in the values of the cookies have been
decoded.
cookieHashRaw()
Return a reference to a hash of the persistent cookies.
The URL encodings in the values of the cookies have NOT
been decoded.
WARNING
None
NOTES
This module has not yet been set up for "installation" in
your local Perl. We currently use a set of conventions for
access to this module, until the install procedures are
developed:
- The source code lives on development and production hosts
in the directory /Volumes/app/cs/csbase/lib.
- By convention, a project maintains perl scripts in
subdirectories of some top-level directory, which we will
call $TOP.
- By convention, projects establish a $TOP/sys directory
which contains a symbolic link from csbase to
/Volummes/app/cs/csbase.
- To get access to the modules, you typically include a
BEGIN of the form:
BEGIN {
...
push (@INC, "../sys/csbase/lib");
}
BUGS
None known.
SEE ALSO
CGI Programming on the World Wide Web, by Shishir
Gundavaram, O'Reilly and Associates, pages 202-204.
AUTHOR
Clint Goss <clint@goss.com>, December 1997