OpenFrame::AbstractCookie - An abstract cookie class
my $cookietin = OpenFrame::AbstractCookie->new(); my $c = OpenFrame::AbstractCookie::CookieElement->new( Name => 'animal', Value => 'parrot', ); $cookietin->addCookie(Cookie => $c); my $c2 = $cookietin->getCookie("colour"); my $colour = $c2->getValue(); $cookietin->deleteCookie("colour");
OpenFrame::AbstractCookie represents cookies inside OpenFrame. Cookies in OpenFrame represent some kind of storage option on the requesting side.
OpenFrame::AbstractCookie
Cookies are a general mechanism which server side connections can use to both store and retrieve information on the client side of the connection. The addition of a simple, persistent, client-side state significantly extends the capabilities of Web-based client/server applications. OpenFrame::AbstractCookie is an abstract cookie class for OpenFrame which can represent cookies no matter how they really come to exist outside OpenFrame (such as CGI or Apache cookie objects).
The new() method creates a new OpenFrame::AbstractCookie object. These can hold multiple cookies (although they must have unique names) inside the cookie tin.
my $cookietin = OpenFrame::AbstractCookie->new();
The addCookie() method adds a OpenFrame::AbstractCookie::CookieElement to the cookie tin.
OpenFrame::AbstractCookie::CookieElement
my $c = OpenFrame::AbstractCookie::CookieElement->new( Name => 'animal', Value => 'parrot', ); $cookietin->addCookie(Cookie => $c);
The getCookie() method returns a cookie element from the cookie tin given its name.
my $c2 = $cookietin->getCookie("colour");
The deleteCookie() method removes a cookie element from the cookie tin given its name.
$cookietin->deleteCookie("colour");
The getCookie() method returns a list of all the cookies in the cookie tin.
my @cookies = $cookietin->getCookies(); foreach my $cookie (@cookies) { print $cookie->getName() . ' = ' . $cookie->getValue() . "\n" }
The OpenFrame::AbstractCookie::CookieElement objects represent individual cookies inside of the OpenFrame::AbstractCookie object.
The following methods can be called on them:
The new() method creates a new cookie ready to be inserted into a OpenFrame::AbstractCookie object using that object's addCookie() method:
my $c = OpenFrame::AbstractCookie::CookieElement->new( Name => 'animal', Value => 'parrot', );
The getName() method returns the name of the cookie.
my $name = $c->getName();
The getValue() method returns the value of the cookie.
my $value = $c->getValue();
The setValue() method sets the value of an existing cookie.
$c->setValue("green");
James Duncan <jduncan@fotango.com>
To install OpenFrame, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenFrame
CPAN shell
perl -MCPAN -e shell install OpenFrame
For more information on module installation, please visit the detailed CPAN module installation guide.