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

NAME

Apache2::FakeRequest - fake request object for testing

SYNOPSIS

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

DESCRIPTION

Apache2::FakeRequest is used to set up an empty Apache2 request object that can be used for testing. The Apache2::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 Apache2 constants are also defined so that using Apache2::Const while testing works, although the values of the constants are hard-coded rather than extracted from the Apache2 source code.

  #!/usr/bin/perl

  use Apache2::FakeRequest ();
  use mymodule ();

  my $request = Apache2::FakeRequest->new('hostname'=>'foobar.com');
  mymodule::handler($request);

SEE ALSO

http://search.cpan.org/~gozer/mod_perl-1.31/lib/Apache/FakeRequest.pm

ACKNOWLEDGEMENTS

This was derived from Apache::FakeRequest by Doug MacEachern.

Thanks also goes out to Gary Josack who was instrumental in helping me get this module working, testing, and installing correctly.

AUTHOR

Jeff Platter <jplatter at cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Jeff Platter

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.