CGI::Apache2::Wrapper::Cookie - cookies via libapreq2


NAME

CGI::Apache2::Wrapper::Cookie - cookies via libapreq2


SYNOPSIS

 use CGI::Apache2::Wrapper::Cookie;
 
 sub handler {
    my $r = shift;
    # create a new Cookie and add it to the headers
    my $cookie = CGI::Apache2::Wrapper::Cookie->new($r,
                                                    -name=>'ID',
                                                    -value=>123456);
    $cookie->bake();
    # fetch existing cookies
    my %cookies = CGI::Apache2::Wrapper::Cookie->fetch($r);
    my $id = $cookies{'ID'}->value;
    return Apache2::Const::OK;
 }


DESCRIPTION

This module provides a wrapper around the Apache2::Cookie manpage. Some methods are overridden in order to provide a the CGI::Cookie manpage-compatible interface.

Cookies are created with the new method:

 my $c = CGI::Apache2::Wrapper::Cookie->new($r,
                             -name    =>  'foo',
                             -value   =>  'bar',
                             -expires =>  '+3M',
                             -domain  =>  '.capricorn.com',
                             -path    =>  '/cgi-bin/database',
                             -secure  =>  1
                            );

with a mandatory first argument of the the Apache2::RequestRec manpage object $r. The remaining arguments are

After creation, cookies can be sent to the browser in the appropriate header by $c->bake();.

Existing cookies can be fetched with %cookies = CGI::Apache2::Wrapper::Cookie->fetch($r);, which requires a mandatory argument of the the Apache2::RequestRec manpage object $r. In a scalar context, this returns a hash reference. The keys of the hash are the values of the name of the Cookie, while the values are the corresponding CGI::Apache2::Wrapper::Cookie object.


Methods

Available methods are


SEE ALSO

CGI, the CGI::Cookie manpage, the Apache2::Cookie manpage, and the CGI::Apache2::Wrapper manpage.

Development of this package takes place at http://cpan-search.svn.sourceforge.net/viewvc/cpan-search/CGI-Apache2-Wrapper/.


SUPPORT

You can find documentation for this module with the perldoc command:

    perldoc CGI::Apache2::Wrapper::Cookie

You can also look for information at:


ENVIRONMENT VARIABLES

If the USE_CGI_PM environment variable is set, the new method will return a the CGI::Cookie manpage object, while fetch will return the corresponding cookies using the CGI::Cookie manpage.


COPYRIGHT

This software is copyright 2007 by Randy Kobes <r.kobes@uwinnipeg.ca>. Use and redistribution are under the same terms as Perl itself; see http://www.perl.com/pub/a/language/misc/Artistic.html.

 CGI::Apache2::Wrapper::Cookie - cookies via libapreq2