NAME

APR::Request - wrapper for libapreq2's module/handle API.

SYNOPSIS

use APR::Request;

$req = APR::Request::Custom->handle($pool, 
                                    "foo=arg1&bar=arg2", 
                                    "cookie=apache",
                                     $parser, 1e6, $bb);
$param = $req->param("foo");
$cookie = $req->jar("cookie");

DESCRIPTION

The APR::Request module provides the base methods for interfacing with libapreq2's module API. It also provides a few utility functions and constants.

This manpage documents the APR::Request and APR::Request::Custom packages.

METHODS

APR::Request::Custom - derived from APR::Request.

handle

APR::Request::Custom->handle($pool, 
                             $query_string,
                             $cookie_header,
                             $parser,
                             $read_limit,
                             $brigade)

Creates a new APR::Request::Custom object. The $query_string and $cookie_headers are immediately parsed into the args and jar tables. The $parser is an APR::Request::Parser object which is invoked when fetching body entries from the $brigade. The $read_limit represents the maximum number of bytes this handle may feed into the parser.

METHODS

APR::Request

pool

$req->pool()

Returns the APR::Pool object associated to this handle.

bucket_alloc

$req->bucket_alloc()

Returns the APR::BucketAlloc object associated to this handle.

jar_status

$req->jar_status()

Returns the final status code of the handle's cookie header parser.

args_status

$req->args_status()

Returns the final status code of the handle's query-string parser.

body_status

$req->body_status()

Returns the final status code of the handle's body parser.

param_status

$req->param_status()

Returns ($req->args_status, $req->body_status) in list context; otherwise returns $req->args_status || $req->body_status.

parse

$req->parse()

Parses the jar, args, and body tables. Returns $req->jar_status, $req->args_status, $req->body_status.

jar

$req->jar()
$req->jar($key)

With no arguments, this method returns a tied APR::Request::Cookie::Table object in scalar context, or the names (in order, with repetitions) of all the parsed cookies.

With the $key argument, in scalar context this method fetches the first matching cookie. In list context it returns all matching cookies. The returned cookies are the values as they appeared in the incoming Cookie header.

args

$req->args()
$req->args($key)

With no arguments, this method returns a tied APR::Request::Param::Table object in scalar context, or the names (in order, with repetitions) of all the parsed query-string arguments.

With the $key argument, in scalar context this method fetches the first matching query-string arg. In list context it returns all matching args.

body

$req->body()
$req->body($key)

With no arguments, this method returns a tied APR::Request::Param::Table object in scalar context, or the names (in order, with repetitions) of all the parsed cookies.

With the $key argument, in scalar context this method fetches the first matching body param. In list context it returns all matching body params.

param

$req->param()
$req->param($key)

With no arguments, this method returns a tied APR::Request::Cookie::Table object in scalar context, or the names (in order, with repetitions) of all the incoming (args + body) params.

With the $key argument, in scalar context this method fetches the first matching param. In list context it returns all matching params.

uploads (APR::Request::Param::Table???)

$req->uploads()
$req->uploads($key)

read_limit

$req->read_limit()
$req->read_limit($set)

brigade_limit

$req->brigade_limit()
$req->brigade_limit($set)

Get/set the brigade_limit for the current parser. This limit determines how many bytes of a file upload that the parser may spool into main memory. Uploads exceeding this limit are written directly to disk.

temp_dir

$req->temp_dir()
$req->temp_dir($set)

Get/set the spool directory for uploads which exceed the configured brigade_limit.

disable_uploads

$req->disable_uploads()

Engage the disable_uploads hook for this request.

upload_hook

$req->upload_hook($callback)

Add an upload hook callback for this request. The arguments to the $callback sub are ($upload, $new_data).

import

Exports a list of subs into the caller's package.

SUBROUTINES

APR::Request

encode

encode($string)

Exportable sub which returns the url-encoded form of $string.

decode

decode($string)

Exportable sub which returns the url-decoded form of $string.

SUBCLASSING

APR::Request

If the instances of your subclass are hash references then you can actually inherit from APR::Request as long as the APR::Request object is stored in an attribute called "r" or "_r". (The APR::Request class effectively does the delegation for you automagically, as long as it knows where to find the APR::Request object to delegate to.) For example:

package MySubClass;
use APR::Request::Custom;
our @ISA = qw(APR::Request);
sub new {
	my($class, @args) = @_;
	return bless { r => APR::Request::Custom->handle(@args) }, $class;
}

SEE ALSO

APR::Request::Error, APR::Request::Param, APR::Request::Cookie, APR::Request::Parser

COPYRIGHT

Copyright 2003-2005  The Apache Software Foundation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.