File: group__apreq__xs__apr__request__param.html

package info (click to toggle)
libapreq2 2.17-3~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 5,108 kB
  • sloc: ansic: 8,263; perl: 5,451; sh: 4,627; cpp: 380; makefile: 270; javascript: 186
file content (315 lines) | stat: -rw-r--r-- 10,666 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<html>
<head>
  <link rel="stylesheet" type="text/css" href="dox.css" />
  <title>libapreq2-2.17: APR::Request::Param</title> 
</head>
<body>
<div id="page-header">
<p class="menu">
   <a href="http://www.apache.org/">Apache Software Foundation</a> &gt; <a href="http://httpd.apache.org">HTTP Server Project</a> &gt;
<a href="http://httpd.apache.org/apreq/">Request Library Subproject</a></p>
<p class="apache">Apache HTTP Server Request Library</p>
<img alt="" src="feather.gif" /></div>
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">APR::Request::Param<div class="ingroups"><a class="el" href="group__apreq__lang.html">Language Bindings</a> &raquo; <a class="el" href="group__apreq__xs.html">Perl</a></div></div>  </div>
</div><!--header-->
<div class="contents">




<ul id="index">
  <li><a href="#NAME">NAME</a></li>
  <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="#OVERLOADS">OVERLOADS</a>
    <ul>
      <li><a href="#">&quot;&quot;</a></li>
    </ul>
  </li>
  <li><a href="#METHODS">METHODS</a>
    <ul>
      <li><a href="#name">name</a></li>
      <li><a href="#value">value</a></li>
      <li><a href="#is_tainted">is_tainted</a></li>
      <li><a href="#charset">charset</a></li>
      <li><a href="#make">make</a></li>
      <li><a href="#info">info</a></li>
      <li><a href="#upload">upload</a></li>
      <li><a href="#upload_filename">upload_filename</a></li>
      <li><a href="#upload_link">upload_link</a></li>
      <li><a href="#upload_slurp">upload_slurp</a></li>
      <li><a href="#upload_size">upload_size</a></li>
      <li><a href="#upload_type">upload_type</a></li>
      <li><a href="#upload_tempname">upload_tempname</a></li>
      <li><a href="#upload_io">upload_io</a></li>
      <li><a href="#upload_fh">upload_fh</a></li>
    </ul>
  </li>
  <li><a href="#METHODS1">METHODS</a>
    <ul>
      <li><a href="#new-TIEHANDLE">new, TIEHANDLE</a></li>
      <li><a href="#READ">READ</a></li>
      <li><a href="#READLINE">READLINE</a></li>
    </ul>
  </li>
  <li><a href="#METHODS2">METHODS</a>
    <ul>
      <li><a href="#read">read</a></li>
      <li><a href="#readline">readline</a></li>
    </ul>
  </li>
  <li><a href="#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
</ul>

<h1 id="NAME">NAME</h1>

<p>APR::Request::Param - wrapper for libapreq2&#39;s param API.</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>use APR::Request::Param;

$arg1 = $req-&gt;args(&#39;alpha&#39;);
$body = $req-&gt;body;
$body-&gt;param_class(&quot;APR::Request::Param&quot;);
ok $_-&gt;isa(&quot;APR::Request::Param&quot;) for values %$body;

@uploads = grep {$_-&gt;upload} values %$body;
$param = $body-&gt;get(&#39;beta&#39;);
$param-&gt;upload_slurp(my $content);</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The <code>APR::Request::Param</code> module provides base methods for interfacing with libapreq2&#39;s param API. It also provides a few utility functions and constants.</p>

<p>This manpage documents version 2.17 of the APR::Request::Param, APR::Request::Brigade, and APR::Request::Brigade::IO packages.</p>

<h1 id="OVERLOADS">OVERLOADS</h1>

<p>APR::Request::Param</p>

<h2 id="">&quot;&quot;</h2>

<pre><code>&quot;$param&quot;</code></pre>

<p>The double-quote interpolation operator maps to <code>APR::Request::Param::value()</code>.</p>

<h1 id="METHODS">METHODS</h1>

<p>APR::Request::Param</p>

<h2 id="name">name</h2>

<pre><code>$param-&gt;name()</code></pre>

<p>Returns the param&#39;s name. This attribute cannot be modified.</p>

<h2 id="value">value</h2>

<pre><code>$param-&gt;value()</code></pre>

<p>Returns the param&#39;s value. This attribute cannot be modified.</p>

<h2 id="is_tainted">is_tainted</h2>

<pre><code>$param-&gt;is_tainted()
$param-&gt;is_tainted($set)</code></pre>

<p>Get/set the param&#39;s internal tainted flag. Note: if the param&#39;s charset is APREQ_CHARSET_UTF8 (8), this also activates the SvUTF8_on flag during calls to name() and/or value().</p>

<pre><code>$tainted = $param-&gt;is_tainted;
$param-&gt;is_tainted(0);
ok $param-&gt;is_tainted == 0;</code></pre>

<h2 id="charset">charset</h2>

<pre><code>$param-&gt;charset()
$param-&gt;charset($set)</code></pre>

<p>Get/set the param&#39;s internal charset. The charset is a number between 0 and 255; the current recognized values are</p>

<dl>

<dt id="APREQ_CHARSET_ASCII-7-bit-us-ascii">0 APREQ_CHARSET_ASCII (7-bit us-ascii)</dt>
<dd>

</dd>
<dt id="APREQ_CHARSET_LATIN1-8-bit-iso-8859-1">1 APREQ_CHARSET_LATIN1 (8-bit iso-8859-1)</dt>
<dd>

</dd>
<dt id="APREQ_CHARSET_CP1252-8-bit-Windows-1252">2 APREQ_CHARSET_CP1252 (8-bit Windows-1252)</dt>
<dd>

</dd>
<dt id="APREQ_CHARSET_UTF8-utf8-encoded-Unicode">8 APREQ_CHARSET_UTF8 (utf8 encoded Unicode)</dt>
<dd>

</dd>
</dl>

<p>See <a>is_tainted</a> above for info about how APREQ_CHARSET_UTF8 relates to perl&#39;s UTF-8 flag.</p>

<pre><code>$charset = $param-&gt;charset;
$param-&gt;charset(2);
ok $param-&gt;charset == 2;</code></pre>

<h2 id="make">make</h2>

<pre><code>APR::Request::Param-&gt;make($pool, $name, $value)</code></pre>

<p>Fast XS param constructor.</p>

<h2 id="info">info</h2>

<pre><code>$param-&gt;info()
$param-&gt;info($set)</code></pre>

<p>Get/set the APR::Table headers for this param.</p>

<h2 id="upload">upload</h2>

<pre><code>$param-&gt;upload()
$param-&gt;upload($set)</code></pre>

<p>Get/set the APR::Brigade file-upload content for this param.</p>

<h2 id="upload_filename">upload_filename</h2>

<pre><code>$param-&gt;upload_filename()</code></pre>

<p>Returns the client-side filename associated with this param.</p>

<h2 id="upload_link">upload_link</h2>

<pre><code>$param-&gt;upload_link($path)</code></pre>

<p>Links the file-upload content with the local file named <code>$path</code>. Creates a hard-link if the spoolfile&#39;s (see <a>upload_tempname</a>) temporary directory is on the same device as <code>$path</code>; otherwise this writes a copy.</p>

<h2 id="upload_slurp">upload_slurp</h2>

<pre><code>$param-&gt;upload_slurp($data)</code></pre>

<p>Reads the entire file-upload content into <code>$data</code>.</p>

<h2 id="upload_size">upload_size</h2>

<pre><code>$param-&gt;upload_size()</code></pre>

<p>Returns the size of the param&#39;s file-upload content.</p>

<h2 id="upload_type">upload_type</h2>

<pre><code>$param-&gt;upload_type()</code></pre>

<p>Returns the MIME-type of the param&#39;s file-upload content.</p>

<h2 id="upload_tempname">upload_tempname</h2>

<pre><code>$param-&gt;upload_tempname()</code></pre>

<p>Returns the name of the local spoolfile for this param.</p>

<h2 id="upload_io">upload_io</h2>

<pre><code>$param-&gt;upload_io()</code></pre>

<p>Returns an <a>APR::Request::Brigade::IO</a> object, which can be treated as a non-seekable IO stream.</p>

<h2 id="upload_fh">upload_fh</h2>

<pre><code>$param-&gt;upload_fh()</code></pre>

<p>Returns a seekable filehandle representing the file-upload content.</p>

<h1 id="METHODS1">METHODS</h1>

<p>APR::Request::Brigade</p>

<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>

<h2 id="new-TIEHANDLE">new, TIEHANDLE</h2>

<pre><code>APR::Request::Brigade-&gt;TIEHANDLE($bb)</code></pre>

<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&#39;s builtin <code>read</code>, <code>readline</code>, and <code>&lt;&gt;</code> operations on handles tied to this package:</p>

<pre><code>use Symbol;
$fh = gensym;
tie *$fh, &quot;APR::Request::Brigade&quot;, $bb;
print while &lt;$fh&gt;;</code></pre>

<h2 id="READ">READ</h2>

<pre><code>$bb-&gt;READ($contents)
$bb-&gt;READ($contents, $length)
$bb-&gt;READ($contents, $length, $offset)</code></pre>

<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>

<h2 id="READLINE">READLINE</h2>

<pre><code>$bb-&gt;READLINE()</code></pre>

<p>Returns the first line of data from the bride. Lines are terminated by linefeeds (the &#39;\012&#39; character), but we may eventually use <code>$/</code> instead.</p>

<h1 id="METHODS2">METHODS</h1>

<p>APR::Request::Brigade::IO</p>

<h2 id="read">read</h2>

<p>OO interface to APR::Request::Brigade::READ.</p>

<h2 id="readline">readline</h2>

<p>OO interface to APR::Request::Brigade::READLINE.</p>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p><a>APR::Request</a>, <a>APR::Table</a>, <a>APR::Brigade</a>.</p>

<h1 id="COPYRIGHT">COPYRIGHT</h1>

<pre><code>Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the &quot;License&quot;); 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 &quot;AS IS&quot; 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.</code></pre>


 </div><!-- contents -->
<div id="footer">
<p class="apache">
Copyright &copy; 2003-2006 <a href="http://www.apache.org">The Apache Software Foundation</a>.<br/>
See <a href="apreq_license.html">LICENSE</a>.</p>
<p class="menu">
<span style="color:#aaa">page generated by <a href="http://www.doxygen.org/"><code>doxygen</code></a>
version 1.9.1 on Thu Aug 18 2022</span>
</p>
</div>
</body>
</html>