
NCGI::Cookie - HTTP Cookie object for NCGI

use NCGI::Cookie;
# subroutine for reading cookies from the query
my $hashref = NCGI::Cookie::fetch();
my $cookie_value = $hashref->{cookie_name};
# object methods for creating cookies to send in the response
my ($name, $value, $epoch, $path, $domain) =
('c1','value',1221397599,'/',undef);
my $c = NCGI::Cookie->new(
name => $name,
value => $value,
expires => $epoch,
path => $path,
domain => $domain,
);
# You can also "print $c->_as_string;"
print $c; # c1=value; expires=Tue 07-Jun-2005 12:02:01 GMT; path=/

NCGI::Cookie provides a simple HTTP Cookie object for Cookie creation, and a fetch subroutine to retrieve cookies sent by a browser.

Returns a HASH reference containing all Cookies sent by the browser.

Create a new NCGI::Cookie object with parameters 'name', 'value', 'expires', 'path' and 'domain'. Only 'name' and 'value' are really necessary as expires will automatically be filled in otherwise.
Set or Get the name of the cookie
Set or Get the value of the cookie. Will be scrubbed for illegal characters.
Set or Get the expiration value of the cookie as a unix epoch.
Set or Get the expiration value of the maximum age of the cookie in seconds.
Set or Get the path of the cookie
Set or Get the domain of the cookie
Sets the expiration date of the cookie to 24 hours ago, effectively removing it from the browser cache.
Returns the string representation of the cookie. The "" operator is overloaded so if you just 'print $cookie' you should also get the string representation.


Mark Lawrence <nomad@null.net>

Copyright (C) 2005 Mark Lawrence <nomad@null.net>
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.