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.
$r
This package exists only to provide a layer of abstraction for Apache2::ASP::API and Apache2::ASP::Test::Base.
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. /usr/local/projects/mysite.com/htdocs/index.asp
/usr/local/projects/mysite.com/htdocs/index.asp
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 content-type header.
content-type
Read-only. Returns the current Apache2::ASP::Mock::Connection object.
Adds $string to the output buffer.
$string
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 <jdrago_999@yahoo.com>
Copyright 2008 John Drago. All rights reserved.
This software is Free software and is licensed under the same terms as perl itself.
To install Apache2::ASP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::ASP
CPAN shell
perl -MCPAN -e shell install Apache2::ASP
For more information on module installation, please visit the detailed CPAN module installation guide.