mod_perl logo
perl icon







previous page: Apache::Leak - Module for tracking memory leaks in mod_perl codepage up: mod_perl APInext page: Apache::Debug - Utilities for debugging embedded perl code


Apache::FakeRequest - fake request object for debugging











Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolsky, Ken Williams
Practical mod_perl

Practical mod_perl

By Stas Bekman, Eric Cholet
The mod_perl Developer's Cookbook

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Kobes


Table of Contents

Synopsis

  use Apache::FakeRequest;
  my $request = Apache::FakeRequest->new(method_name => 'value', ...);


TOP

Description

Apache::FakeRequest is used to set up an empty Apache request object that can be used for debugging.

The Apache::FakeRequest methods just set internal variables of the same name as the method and return the value of the internal variables. Initial values for methods can be specified when the object is created. The print method prints to STDOUT.

Subroutines for Apache constants are also defined so that using Apache::Constants while debugging works, although the values of the constants are hard-coded rather than extracted from the Apache source code.

  #!/usr/bin/perl
  
  use Apache::FakeRequest ();
  use mymodule ();
  
  my $request = Apache::FakeRequest->new('get_remote_host'=>'foobar.com');
  mymodule::handler($request);


TOP

Authors

Doug MacEachern, with contributions from Andrew Ford <A.Ford@ford-mason.co.uk>.







TOP
previous page: Apache::Leak - Module for tracking memory leaks in mod_perl codepage up: mod_perl APInext page: Apache::Debug - Utilities for debugging embedded perl code