Apache HTTP Server Request Library
APR::Request::Param - wrapper for libapreq2's param API.
use APR::Request::Param;
$arg1 = $req->args('alpha'); $body = $req->body; $body->param_class("APR::Request::Param"); ok $_->isa("APR::Request::Param") for values %$body;
@uploads = grep {$_->upload} values %$body;
The APR::Request::Param
module provides base methods
for interfacing with libapreq2's param API. It also provides
a few utility functions and constants.
APR::Request::Param
"$param"
The double-quote interpolation operator maps to
APR::Request::Param::value()
.
APR::Request::Param
$param->name()
Returns the param's name. This attribute cannot be modified.
$param->value()
Returns the param's value. This attribute cannot be modified.
$param->is_tainted() $param->is_tainted($set)
Get/set the param's internal tainted flag.
Note: if the param's charset is APREQ_CHARSET_UTF8 (8),
this also activates the SvUTF8_on flag during calls
to name()
and/or value().
$param->charset() $param->charset($set)
Get/set the param's internal charset. The charset is a number between 0 and 255; the current recognized values are
See the is_tainted manpage above for info about how APREQ_CHARSET_UTF8 relates to perl's UTF-8 flag.
APR::Request::Param->make($pool, $name, $value)
Fast XS param constructor.
$param->info() $param->info($set)
Get/set the APR::Table headers for this param.
$param->upload() $param->upload($set)
Get/set the APR::Brigade file-upload content for this param.
$param->upload_filename()
Returns the client-side filename associated with this param.
$param->upload_link($path)
Links the file-upload content with the local file named $path
.
Creates a hard-link if the spoolfile's (see the upload_tempname manpage)
temporary directory is on the same device as $path
;
otherwise this writes a copy.
$param->upload_slurp($data)
Reads the entire file-upload content into $data
.
$param->upload_size()
Returns the size of the param's file-upload content.
$param->upload_type()
Returns the MIME-type of the param's file-upload content.
$param->upload_tempname()
Returns the name of the local spoolfile for this param.
$param->upload_io()
Returns an the APR::Request::Brigade::IO manpage object, which can be treated as a non-seekable IO stream.
$param->upload_fh
Returns a seekable filehandle representing the file-upload content.
APR::Request::Param::Table
$table->param_class() $table->param_class($set)
Get/set the class each table element is blessed into during a the get manpage or FETCH call. If defined, the class must be derived from APR::Request::Param. When called with $set, it returns the $table. Otherwise it returns the name of the current class, or undef if no param class is defined.
$table->get($key)
Same as FETCH.
$table->FETCH($key)
In scalar context, this returns the first value matching $key (note: see NEXTKEY for additional notes). The match is always case-insensitive. In list context, this returns all matching values. Note: the type of the return values depends on the table's current param_class.
Synonym for defined
; these tables are not
allowed to contain undefined values. Since these
are constant tables, they don't autovivify either.
$table->NEXTKEY()
Returns the next key in the table. For perl 5.8+, if the key is multivalued, a subsequent FETCH on this key will return the corresponding value, until either NEXTKEY or FIRSTKEY is invoked again. For perl 5.6, FETCH always returns the first value.
$table->FIRSTKEY()
Returns the first key in the table.
$table->do($callback, @keys)
Same as APR::Table::do; iterates over the table calling $callback->($key, $value) for each matching @keys. If @keys is empty, this iterates over the entire table.
Note: The type of $value inserted into the callback depends on the table's current value_class.
APR::Request::Brigade
This class is derived from APR::Brigade, providing additional
methods for TIEHANDLE, READ and READLINE. To be memory efficient,
these methods delete buckets from the brigade as soon as their
data is actually read, so you cannot seek
on handles tied to
this class. Such handles have semantics similar to that of a
read-only socket.
APR::Request::Brigade->TIEHANDLE($bb)
Creates a copy of the bucket brigade represented by $bb, and
blesses that copy into the APR::Request::Brigade class. This
provides syntactic sugar for using perl's builtin read
, readline
,
and <>
operations on handles tied to this package:
use Symbol; $fh = gensym; tie *$fh, "APR::Request:Brigade", $bb; print while <$fh>;
$bb->READ($contents) $bb->READ($contents, $length) $bb->READ($contents, $length, $offset)
Reads data from the brigade $bb into $contents. When omitted
$length defaults to -1
, which reads the first bucket into $contents.
A positive $length will read in $length bytes, or the remainder of the
brigade, whichever is greater. $offset represents the index in $context
to read the new data.
$bb->READLINE()
Returns the first line of data from the bride. Lines are terminated by
linefeeds (the '\012' character), but we may eventually use $/
instead.
APR::Request::Brigade::IO
OO interface to APR::Request::Brigade::READ.
OO interface to APR::Request::Brigade::READLINE.
the APR::Request manpage, the APR::Table manpage, the APR::Brigade manpage.
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.