The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

  Apache::FakeCookie - fake request object for debugging

SYNOPSIS

  use Apache::FakeCookie;

  loads into Apache::Cookie namespace

DESCRIPTION

This module assists authors of Apache::* modules write test suites that would use Apache::Cookie without actually having to run and query a server to test the cookie methods. Loaded in the test script after the author's target module is loaded, Apache::FakeCookie

Usage is the same as Apache::Cookie

METHODS

Implements all methods of Apache::Cookie

See man Apache::Cookie for details of usage.

remove -- new method

Delete the given named cookie or the cookie represented by the pointer

  $cookie->remove;

  Apache::Cookie->remove('name required');

  $cookie->remove('some name');
        for test purposes, same as:
    $cookie = Apache::Cookie->new($r,
        -name   => 'some name',
    );
    $cookie->bake;
new
  $cookie = Apache::Cookie->new($r,
        -name    => 'some name',
        -value   => 'my value',
        -expires => 'time or relative time,
        -path    => 'some path',
        -domain  => 'some.domain',
        -secure  => 1,
  );

The Apache request object, $r, is not used and may be undef.

bake
  Store the cookie in local memory.

  $cookie->bake;
fetch
  Return cookie values from local memory

  $cookies = Apache::Cookie->fetch;     # hash ref
  %cookies = Apache::Cookie->fetch;
as_string
  Format the cookie object as a string, 
  same as Apache::Cookie
parse
  The same as fetch unless a cookie string is present.

  $cookies = Apache::Cookie->fetch(raw cookie string);
  %cookies = Apache::Cookie->fetch(raw cookie string)

  Cookie memory is cleared and replaced with the contents
  of the parsed "raw cookie string".
name, value, domain, path, secure
  Get or set the value of the designated cookie.
  These are all just text strings for test use,
  "value" accepts SCALARS, HASHrefs, ARRAYrefs
expires
  Sets or returns time in the same format as Apache::Cookie 
  and CGI::Cookie. See their man pages for details

SEE ALSO

Apache::Cookie(3)

AUTHORS

Michael Robinton michael@bizsystems.com Inspiration and code for subs (expires, expires_calc, parse) from CGI::Util by Lincoln Stein

COPYRIGHT and LICENSE

  Copyright 2003 Michael Robinton, BizSystems.

This module is free software; you can redistribute it and/or modify it under the terms of either:

  a) the GNU General Public License as published by the Free Software
  Foundation; either version 1, or (at your option) any later version,
  
  or

  b) the "Artistic License" which comes with this module.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

You should have received a copy of the Artistic License with this module, in the file ARTISTIC. If not, I'll be glad to provide one.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA