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

NAME

Apache2::ASP::Mock::RequestRec - Mimics the mod_perl2 Apache2::RequestRec object ($r)

SYNOPSIS

  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;

DESCRIPTION

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.

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!

PUBLIC PROPERTIES

filename

Read-only. Returns the absolute filename for the current request - i.e. /usr/local/projects/mysite.com/htdocs/index.asp

pnotes( $name [, $value ] )

Read/Write. Set or get a variable for the duration of the current request.

buffer

Read-only. Returns the contents of the current output buffer.

pool

Read-only. Returns the current Apache2::ASP::Mock::Pool object.

status( [$new_status] )

Read/Write. Set or get the HTTP status code, a la Apache2::Const.

uri( [$new_uri] )

Read/Write. Set or get the request URI.

method

Read-only. Gets the request method - i.e. 'get' or 'post'.

content_type( [$new_content_type] )

Read/Write. Set or get the outgoing content-type header.

connection

Read-only. Returns the current Apache2::ASP::Mock::Connection object.

PUBLIC METHODS

print( $string )

Adds $string to the output buffer.

rflush( )

Does nothing. Here only to maintain compatibility with a normal mod_perl2 environment.

BUGS

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.

HOMEPAGE

Please visit the Apache2::ASP homepage at http://www.devstack.com/ to see examples of Apache2::ASP in action.

AUTHOR

John Drago <jdrago_999@yahoo.com>

COPYRIGHT

Copyright 2008 John Drago. All rights reserved.

LICENSE

This software is Free software and is licensed under the same terms as perl itself.