NAME
APR::Emulate::PSGI - Class that Emulates the mod_perl2 APR Object (Apache2::RequestRec, et al)
SYNOPSIS
use APR::Emulate::PSGI;
my $r = APR::Emulate::PSGI->new($psgi_env);
# Or in a CGI environment:
my $r = APR::Emulate::PSGI->new();
DESCRIPTION
This class emulates the mod_perl2 APR object. It expects either a PSGI environment hashref to be passed in, or to read HTTP environment information from the global %ENV.
Currently this module is little more than a proof of concept. There are rough edges.
Use at your own discretion. Contributions welcome.
METHODS
- new
 - 
Creates an object that emulates the mod_perl2 APR object.
my $r = APR::Emulate::PSGI->new($psgi_env);HTTP environment information is read from the PSGI environment that is passed in as a parameter. If no PSGI environment is supplied, environment information is read from the global %ENV.
 - psgi_status
 - 
Returns the numeric HTTP response that should be used when building a PSGI response.
my $status = $r->psgi_status();The value is determined by looking at the current value of "status_line", or if that is not set, the current value of "status", or if that is not set, defaults to 200.
 - psgi_headers
 - 
Returns an arrayref of headers which can be used when building a PSGI response.
A Content-Length header is not included, and must be added in accordance with the PSGI specification, while building the PSGI response.
my $headers_arrayref = $r->psgi_headers(); 
Request Methods
- headers_in
 - 
Emulates "headers_in" in Apache2::RequestRec.
 - method
 - 
Emulates "method" in Apache2::RequestRec.
 - uri
 - 
Emulates "uri" in Apache2::RequestRec.
 - parsed_uri
 - 
Emulates "parsed_uri" in Apache2::URI.
 - args
 - 
Emulates "args" in Apache2::RequestRec.
 - read
 - 
Emulates "read" in Apache2::RequestIO.
 - pool
 - 
Emulates "pool" in Apache2::RequestRec.
 
Response Methods
- headers_out
 - 
Emulates "headers_out" in Apache2::RequestRec.
 - err_headers_out
 - 
Emulates "err_headers_out" in Apache2::RequestRec.
 - no_cache
 - 
Emulates "no_cache" in Apache2::RequestUtil.
 - status
 - 
Emulates "status" in Apache2::RequestRec.
 - status_line
 - 
Emulates "status_line" in Apache2::RequestRec.
 - content_type
 - 
Emulates "content_type" in Apache2::RequestRec.
If no PSGI enviroment is provided to "new", calling this method with a parameter will cause HTTP headers to be sent.
 - 
Emulates "print" in Apache2::RequestIO.
 - rflush
 - 
Emulates "rflush" in Apache2::RequestIO.
 
SEE ALSO
AUTHOR
Nathan Gray, <kolibrie@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2013, 2014 by Nathan Gray
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.