Home | Wiki | OI 1.x Docs | OI 2.x Docs OI logo

NAME

OpenInteract2::Cookie - Generic cookie methods

SYNOPSIS

 # Create cookies from the request
 
 my $cookies = OpenInteract2::Cookie->parse( $request->cookie_header );
 
 # Create a new cookie and add it to the response manually
 
 my $cookie = OpenInteract2::Cookie->create({ name    => 'session_id',
                                              value   => $session->id,
                                              expires => '+3M' });
 $response->add_cookie( $cookie );
 
 # Create the cookie and add it to the response automatically
 
 OpenInteract2::Cookie->create({ name    => 'session_id',
                                 value   => $session->id,
                                 expires => '+3M',
                                 HEADER  => 'yes' });
 
 # Expire a cookie named 'comment_memory'
 
 if ( $forget_info ) {
     OpenInteract2::Cookie->expire( 'comment_memory' );
 }

DESCRIPTION

This module defines methods for parsing and creating cookies. If you do not know what a cookie is, check out:

 http://www.ics.uci.edu/pub/ietf/http/rfc2109.txt

Behind the scenes we use CGI::Cookie to do the actual work. We just take all the credit.

METHODS

All methods are class methods.

parse( $header )

Parses $header into a series of CGI::Cookie objects, which are returned in a hashref with the cookie names as keys and the objects as values.

create( \%params )

Creates a CGI::Cookie object with the given parameters, modified slightly to fit our naming conventions. Additionally, you can add the cookie directly to the response header by passing a true value for the parameter 'HEADER'.

Parameters:

expire( $cookie_name )

Expire the cookie with the given name. We currently do this by creating another cookie with an expiration date three months in the past and issuing it to the response header. This should tell the browser to clear out any cookies under this name.

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

CGI::Cookie

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>

Generated from the OpenInteract 1.99_03 source.


Home | Wiki | OI 1.x Docs | OI 2.x Docs
SourceForge Logo