Apache2-WebApp-Plugin-Cookie

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    Perl one liner using CPAN.pm:

      $ perl -MCPAN -e 'install Apache2::WebApp::Plugin::Cookie'

    Use of CPAN.pm in interactive mode:

      $ perl -MCPAN -e shell
      cpan> install Apache2::WebApp::Plugin::Cookie
      cpan> quit

    Just like the manual installation of Perl modules, the user may need
    root access during this process to insure write permission is allowed
    within the installation directory.

CONFIGURATION
    In order to set a browser cookie, you need to specify a valid hostname
    in your *webapp.conf*

      [apache]
      domain = www.domain.com

OBJECT METHODS
  set
    Set a new browser cookie.

      $c->plugin('Cookie')->set( $c, {
            name    => 'foo',
            value   => 'bar',
            expires => '24h',
            domain  => 'www.domain.com',    # optional
            secure  => 0,
        });

  get
    Return the browser cookie value.

      my $result = $c->plugin('Cookie')->get($name);

      # bar is value of $result

  delete
    Delete a browser cookie by name.

      $c->plugin('Cookie')->delete( \%controller, $name );

EXAMPLE
      package Example;

      use strict;

      sub _default {
          my ( $self, $c ) = @_;

          $c->plugin('Cookie')->set( $c, {
              name    => 'foo',
              value   => 'bar',
              expires => '1h',
              secure  => 0,
            });

          $c->plugin('CGI')->redirect( $c, '/app/example/verify' );
      }

      sub verify {
          my ( $self, $c ) = @_;

          $c->request->content_type('text/html');

          print $c->plugin('Cookie')->get('foo');
      }

      1;

SEE ALSO
    Apache2::WebApp, Apache2::WebApp::Plugin, Apache2::Cookie

AUTHOR
    Marc S. Brooks, <mbrooks@cpan.org> - <http://mbrooks.info>

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

    See <http://dev.perl.org/licenses/artistic.html>



( run in 0.887 second using v1.01-cache-2.11-cpan-39bf76dae61 )