Apache2::ASP::Mock::RequestRec - Mimics the mod_perl2 Apache2::RequestRec object ($r)
my $r = Apache2::ASP::HTTPContext->current->r; $r->filename( '/index.asp' ); # '/usr/local/projects/mysite.com/htdocs/index.asp $r->pnotes( foo => 'bar' ); # set foo = 'bar' my $foo = $r->pnotes( 'foo' ); # get foo my $output_buffer_contents = $r->buffer; my $mock_apr_pool = $r->pool; $r->status( '302 Found' ); my $status = $r->status; my $uri = $r->uri; $r->uri('/new.asp'); my $method = $r->method; # get/post $r->content_type( 'text/html' ); my $type = $r->content_type; my $mock_connection = $r->connection; $r->print( 'some string' ); $r->rflush;
This package provides "mock" access to what would normally be an Apache2::RequestRec object - known by the name
$r in a normal mod_perl2 environment.
NOTE: The purpose of this package is only to mimic enough of the functionality of Apache2::RequestRec to get by without it - specifically during testing.
If you require additional functionality, patches are welcome!
Read-only. Returns the absolute filename for the current request - i.e.
Read/Write. Set or get a variable for the duration of the current request.
Read-only. Returns the contents of the current output buffer.
Read-only. Returns the current Apache2::ASP::Mock::Pool object.
Read/Write. Set or get the HTTP status code, a la Apache2::Const.
Read/Write. Set or get the request URI.
Read-only. Gets the request method - i.e. 'get' or 'post'.
Read/Write. Set or get the outgoing
Read-only. Returns the current Apache2::ASP::Mock::Connection object.
$string to the output buffer.
Does nothing. Here only to maintain compatibility with a normal mod_perl2 environment.
It's possible that some bugs have found their way into this release.
Use RT http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP to submit bug reports.
Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.
John Drago <firstname.lastname@example.org>
Copyright 2008 John Drago. All rights reserved.
This software is Free software and is licensed under the same terms as perl itself.