Apache::FakeCookie - fake request object for debugging


Apache-FakeCookie documentation  | view source Contained in the Apache-FakeCookie distribution.

Index


NAME

Top

  Apache::FakeCookie - fake request object for debugging

SYNOPSIS

Top

  use Apache::FakeCookie;

  loads into Apache::Cookie namespace

DESCRIPTION

Top

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

Top

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

Top

Apache::Cookie(3)

AUTHORS

Top

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

COPYRIGHT and LICENSE

Top


Apache-FakeCookie documentation  | view source Contained in the Apache-FakeCookie distribution.