| 1 |
<html> |
| 2 |
<head> |
| 3 |
<link rel="stylesheet" type="text/css" href="dox.css" /> |
| 4 |
<title>libapreq2-2.17: APR::Request::Param</title> |
| 5 |
</head> |
| 6 |
<body> |
| 7 |
<div id="page-header"> |
| 8 |
<p class="menu"> |
| 9 |
<a href="http://www.apache.org/">Apache Software Foundation</a> > <a href="http://httpd.apache.org">HTTP Server Project</a> > |
| 10 |
<a href="http://httpd.apache.org/apreq/">Request Library Subproject</a></p> |
| 11 |
<p class="apache">Apache HTTP Server Request Library</p> |
| 12 |
<img alt="" src="feather.gif" /></div> |
| 13 |
<!-- Generated by Doxygen 1.9.1 --> |
| 14 |
<script type="text/javascript" src="menudata.js"></script> |
| 15 |
<script type="text/javascript" src="menu.js"></script> |
| 16 |
<script type="text/javascript"> |
| 17 |
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ |
| 18 |
$(function() { |
| 19 |
initMenu('',false,false,'search.php','Search'); |
| 20 |
}); |
| 21 |
/* @license-end */</script> |
| 22 |
<div id="main-nav"></div> |
| 23 |
</div><!-- top --> |
| 24 |
<div class="header"> |
| 25 |
<div class="headertitle"> |
| 26 |
<div class="title">APR::Request::Param<div class="ingroups"><a class="el" href="group__apreq__lang.html">Language Bindings</a> » <a class="el" href="group__apreq__xs.html">Perl</a></div></div> </div> |
| 27 |
</div><!--header--> |
| 28 |
<div class="contents"> |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
<ul id="index"> |
| 34 |
<li><a href="#NAME">NAME</a></li> |
| 35 |
<li><a href="#SYNOPSIS">SYNOPSIS</a></li> |
| 36 |
<li><a href="#DESCRIPTION">DESCRIPTION</a></li> |
| 37 |
<li><a href="#OVERLOADS">OVERLOADS</a> |
| 38 |
<ul> |
| 39 |
<li><a href="#">""</a></li> |
| 40 |
</ul> |
| 41 |
</li> |
| 42 |
<li><a href="#METHODS">METHODS</a> |
| 43 |
<ul> |
| 44 |
<li><a href="#name">name</a></li> |
| 45 |
<li><a href="#value">value</a></li> |
| 46 |
<li><a href="#is_tainted">is_tainted</a></li> |
| 47 |
<li><a href="#charset">charset</a></li> |
| 48 |
<li><a href="#make">make</a></li> |
| 49 |
<li><a href="#info">info</a></li> |
| 50 |
<li><a href="#upload">upload</a></li> |
| 51 |
<li><a href="#upload_filename">upload_filename</a></li> |
| 52 |
<li><a href="#upload_link">upload_link</a></li> |
| 53 |
<li><a href="#upload_slurp">upload_slurp</a></li> |
| 54 |
<li><a href="#upload_size">upload_size</a></li> |
| 55 |
<li><a href="#upload_type">upload_type</a></li> |
| 56 |
<li><a href="#upload_tempname">upload_tempname</a></li> |
| 57 |
<li><a href="#upload_io">upload_io</a></li> |
| 58 |
<li><a href="#upload_fh">upload_fh</a></li> |
| 59 |
</ul> |
| 60 |
</li> |
| 61 |
<li><a href="#METHODS1">METHODS</a> |
| 62 |
<ul> |
| 63 |
<li><a href="#new-TIEHANDLE">new, TIEHANDLE</a></li> |
| 64 |
<li><a href="#READ">READ</a></li> |
| 65 |
<li><a href="#READLINE">READLINE</a></li> |
| 66 |
</ul> |
| 67 |
</li> |
| 68 |
<li><a href="#METHODS2">METHODS</a> |
| 69 |
<ul> |
| 70 |
<li><a href="#read">read</a></li> |
| 71 |
<li><a href="#readline">readline</a></li> |
| 72 |
</ul> |
| 73 |
</li> |
| 74 |
<li><a href="#SEE-ALSO">SEE ALSO</a></li> |
| 75 |
<li><a href="#COPYRIGHT">COPYRIGHT</a></li> |
| 76 |
</ul> |
| 77 |
|
| 78 |
<h1 id="NAME">NAME</h1> |
| 79 |
|
| 80 |
<p>APR::Request::Param - wrapper for libapreq2's param API.</p> |
| 81 |
|
| 82 |
<h1 id="SYNOPSIS">SYNOPSIS</h1> |
| 83 |
|
| 84 |
<pre><code>use APR::Request::Param; |
| 85 |
|
| 86 |
$arg1 = $req->args('alpha'); |
| 87 |
$body = $req->body; |
| 88 |
$body->param_class("APR::Request::Param"); |
| 89 |
ok $_->isa("APR::Request::Param") for values %$body; |
| 90 |
|
| 91 |
@uploads = grep {$_->upload} values %$body; |
| 92 |
$param = $body->get('beta'); |
| 93 |
$param->upload_slurp(my $content);</code></pre> |
| 94 |
|
| 95 |
<h1 id="DESCRIPTION">DESCRIPTION</h1> |
| 96 |
|
| 97 |
<p>The <code>APR::Request::Param</code> module provides base methods for interfacing with libapreq2's param API. It also provides a few utility functions and constants.</p> |
| 98 |
|
| 99 |
<p>This manpage documents version 2.17 of the APR::Request::Param, APR::Request::Brigade, and APR::Request::Brigade::IO packages.</p> |
| 100 |
|
| 101 |
<h1 id="OVERLOADS">OVERLOADS</h1> |
| 102 |
|
| 103 |
<p>APR::Request::Param</p> |
| 104 |
|
| 105 |
<h2 id="">""</h2> |
| 106 |
|
| 107 |
<pre><code>"$param"</code></pre> |
| 108 |
|
| 109 |
<p>The double-quote interpolation operator maps to <code>APR::Request::Param::value()</code>.</p> |
| 110 |
|
| 111 |
<h1 id="METHODS">METHODS</h1> |
| 112 |
|
| 113 |
<p>APR::Request::Param</p> |
| 114 |
|
| 115 |
<h2 id="name">name</h2> |
| 116 |
|
| 117 |
<pre><code>$param->name()</code></pre> |
| 118 |
|
| 119 |
<p>Returns the param's name. This attribute cannot be modified.</p> |
| 120 |
|
| 121 |
<h2 id="value">value</h2> |
| 122 |
|
| 123 |
<pre><code>$param->value()</code></pre> |
| 124 |
|
| 125 |
<p>Returns the param's value. This attribute cannot be modified.</p> |
| 126 |
|
| 127 |
<h2 id="is_tainted">is_tainted</h2> |
| 128 |
|
| 129 |
<pre><code>$param->is_tainted() |
| 130 |
$param->is_tainted($set)</code></pre> |
| 131 |
|
| 132 |
<p>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().</p> |
| 133 |
|
| 134 |
<pre><code>$tainted = $param->is_tainted; |
| 135 |
$param->is_tainted(0); |
| 136 |
ok $param->is_tainted == 0;</code></pre> |
| 137 |
|
| 138 |
<h2 id="charset">charset</h2> |
| 139 |
|
| 140 |
<pre><code>$param->charset() |
| 141 |
$param->charset($set)</code></pre> |
| 142 |
|
| 143 |
<p>Get/set the param's internal charset. The charset is a number between 0 and 255; the current recognized values are</p> |
| 144 |
|
| 145 |
<dl> |
| 146 |
|
| 147 |
<dt id="APREQ_CHARSET_ASCII-7-bit-us-ascii">0 APREQ_CHARSET_ASCII (7-bit us-ascii)</dt> |
| 148 |
<dd> |
| 149 |
|
| 150 |
</dd> |
| 151 |
<dt id="APREQ_CHARSET_LATIN1-8-bit-iso-8859-1">1 APREQ_CHARSET_LATIN1 (8-bit iso-8859-1)</dt> |
| 152 |
<dd> |
| 153 |
|
| 154 |
</dd> |
| 155 |
<dt id="APREQ_CHARSET_CP1252-8-bit-Windows-1252">2 APREQ_CHARSET_CP1252 (8-bit Windows-1252)</dt> |
| 156 |
<dd> |
| 157 |
|
| 158 |
</dd> |
| 159 |
<dt id="APREQ_CHARSET_UTF8-utf8-encoded-Unicode">8 APREQ_CHARSET_UTF8 (utf8 encoded Unicode)</dt> |
| 160 |
<dd> |
| 161 |
|
| 162 |
</dd> |
| 163 |
</dl> |
| 164 |
|
| 165 |
<p>See <a>is_tainted</a> above for info about how APREQ_CHARSET_UTF8 relates to perl's UTF-8 flag.</p> |
| 166 |
|
| 167 |
<pre><code>$charset = $param->charset; |
| 168 |
$param->charset(2); |
| 169 |
ok $param->charset == 2;</code></pre> |
| 170 |
|
| 171 |
<h2 id="make">make</h2> |
| 172 |
|
| 173 |
<pre><code>APR::Request::Param->make($pool, $name, $value)</code></pre> |
| 174 |
|
| 175 |
<p>Fast XS param constructor.</p> |
| 176 |
|
| 177 |
<h2 id="info">info</h2> |
| 178 |
|
| 179 |
<pre><code>$param->info() |
| 180 |
$param->info($set)</code></pre> |
| 181 |
|
| 182 |
<p>Get/set the APR::Table headers for this param.</p> |
| 183 |
|
| 184 |
<h2 id="upload">upload</h2> |
| 185 |
|
| 186 |
<pre><code>$param->upload() |
| 187 |
$param->upload($set)</code></pre> |
| 188 |
|
| 189 |
<p>Get/set the APR::Brigade file-upload content for this param.</p> |
| 190 |
|
| 191 |
<h2 id="upload_filename">upload_filename</h2> |
| 192 |
|
| 193 |
<pre><code>$param->upload_filename()</code></pre> |
| 194 |
|
| 195 |
<p>Returns the client-side filename associated with this param.</p> |
| 196 |
|
| 197 |
<h2 id="upload_link">upload_link</h2> |
| 198 |
|
| 199 |
<pre><code>$param->upload_link($path)</code></pre> |
| 200 |
|
| 201 |
<p>Links the file-upload content with the local file named <code>$path</code>. Creates a hard-link if the spoolfile's (see <a>upload_tempname</a>) temporary directory is on the same device as <code>$path</code>; otherwise this writes a copy.</p> |
| 202 |
|
| 203 |
<h2 id="upload_slurp">upload_slurp</h2> |
| 204 |
|
| 205 |
<pre><code>$param->upload_slurp($data)</code></pre> |
| 206 |
|
| 207 |
<p>Reads the entire file-upload content into <code>$data</code>.</p> |
| 208 |
|
| 209 |
<h2 id="upload_size">upload_size</h2> |
| 210 |
|
| 211 |
<pre><code>$param->upload_size()</code></pre> |
| 212 |
|
| 213 |
<p>Returns the size of the param's file-upload content.</p> |
| 214 |
|
| 215 |
<h2 id="upload_type">upload_type</h2> |
| 216 |
|
| 217 |
<pre><code>$param->upload_type()</code></pre> |
| 218 |
|
| 219 |
<p>Returns the MIME-type of the param's file-upload content.</p> |
| 220 |
|
| 221 |
<h2 id="upload_tempname">upload_tempname</h2> |
| 222 |
|
| 223 |
<pre><code>$param->upload_tempname()</code></pre> |
| 224 |
|
| 225 |
<p>Returns the name of the local spoolfile for this param.</p> |
| 226 |
|
| 227 |
<h2 id="upload_io">upload_io</h2> |
| 228 |
|
| 229 |
<pre><code>$param->upload_io()</code></pre> |
| 230 |
|
| 231 |
<p>Returns an <a>APR::Request::Brigade::IO</a> object, which can be treated as a non-seekable IO stream.</p> |
| 232 |
|
| 233 |
<h2 id="upload_fh">upload_fh</h2> |
| 234 |
|
| 235 |
<pre><code>$param->upload_fh()</code></pre> |
| 236 |
|
| 237 |
<p>Returns a seekable filehandle representing the file-upload content.</p> |
| 238 |
|
| 239 |
<h1 id="METHODS1">METHODS</h1> |
| 240 |
|
| 241 |
<p>APR::Request::Brigade</p> |
| 242 |
|
| 243 |
<p>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 <code>seek</code> on handles tied to this class. Such handles have semantics similar to that of a read-only socket.</p> |
| 244 |
|
| 245 |
<h2 id="new-TIEHANDLE">new, TIEHANDLE</h2> |
| 246 |
|
| 247 |
<pre><code>APR::Request::Brigade->TIEHANDLE($bb)</code></pre> |
| 248 |
|
| 249 |
<p>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 <code>read</code>, <code>readline</code>, and <code><></code> operations on handles tied to this package:</p> |
| 250 |
|
| 251 |
<pre><code>use Symbol; |
| 252 |
$fh = gensym; |
| 253 |
tie *$fh, "APR::Request::Brigade", $bb; |
| 254 |
print while <$fh>;</code></pre> |
| 255 |
|
| 256 |
<h2 id="READ">READ</h2> |
| 257 |
|
| 258 |
<pre><code>$bb->READ($contents) |
| 259 |
$bb->READ($contents, $length) |
| 260 |
$bb->READ($contents, $length, $offset)</code></pre> |
| 261 |
|
| 262 |
<p>Reads data from the brigade $bb into $contents. When omitted $length defaults to <code>-1</code>, 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.</p> |
| 263 |
|
| 264 |
<h2 id="READLINE">READLINE</h2> |
| 265 |
|
| 266 |
<pre><code>$bb->READLINE()</code></pre> |
| 267 |
|
| 268 |
<p>Returns the first line of data from the bride. Lines are terminated by linefeeds (the '\012' character), but we may eventually use <code>$/</code> instead.</p> |
| 269 |
|
| 270 |
<h1 id="METHODS2">METHODS</h1> |
| 271 |
|
| 272 |
<p>APR::Request::Brigade::IO</p> |
| 273 |
|
| 274 |
<h2 id="read">read</h2> |
| 275 |
|
| 276 |
<p>OO interface to APR::Request::Brigade::READ.</p> |
| 277 |
|
| 278 |
<h2 id="readline">readline</h2> |
| 279 |
|
| 280 |
<p>OO interface to APR::Request::Brigade::READLINE.</p> |
| 281 |
|
| 282 |
<h1 id="SEE-ALSO">SEE ALSO</h1> |
| 283 |
|
| 284 |
<p><a>APR::Request</a>, <a>APR::Table</a>, <a>APR::Brigade</a>.</p> |
| 285 |
|
| 286 |
<h1 id="COPYRIGHT">COPYRIGHT</h1> |
| 287 |
|
| 288 |
<pre><code>Licensed to the Apache Software Foundation (ASF) under one or more |
| 289 |
contributor license agreements. See the NOTICE file distributed with |
| 290 |
this work for additional information regarding copyright ownership. |
| 291 |
The ASF licenses this file to You under the Apache License, Version 2.0 |
| 292 |
(the "License"); you may not use this file except in compliance with |
| 293 |
the License. You may obtain a copy of the License at |
| 294 |
|
| 295 |
http://www.apache.org/licenses/LICENSE-2.0 |
| 296 |
|
| 297 |
Unless required by applicable law or agreed to in writing, software |
| 298 |
distributed under the License is distributed on an "AS IS" BASIS, |
| 299 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 300 |
See the License for the specific language governing permissions and |
| 301 |
limitations under the License.</code></pre> |
| 302 |
|
| 303 |
|
| 304 |
</div><!-- contents --> |
| 305 |
<div id="footer"> |
| 306 |
<p class="apache"> |
| 307 |
Copyright © 2003-2006 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/> |
| 308 |
See <a href="apreq_license.html">LICENSE</a>.</p> |
| 309 |
<p class="menu"> |
| 310 |
<span style="color:#aaa">page generated by <a href="http://www.doxygen.org/"><code>doxygen</code></a> |
| 311 |
version 1.9.1 on Thu Aug 18 2022</span> |
| 312 |
</p> |
| 313 |
</div> |
| 314 |
</body> |
| 315 |
</html> |