1Param(3) User Contributed Perl Documentation Param(3)
2
3
4
6 APR::Request::Param - wrapper for libapreq2's param API.
7
9 use APR::Request::Param;
10
11 $arg1 = $req->args('alpha');
12 $body = $req->body;
13 $body->param_class("APR::Request::Param");
14 ok $_->isa("APR::Request::Param") for values %$body;
15
16 @uploads = grep {$_->upload} values %$body;
17 $param = $body->get('beta');
18 $param->upload_slurp(my $content);
19
21 The "APR::Request::Param" module provides base methods for interfacing
22 with libapreq2's param API. It also provides a few utility functions
23 and constants.
24
25 This manpage documents version 2.09 of the APR::Request::Param,
26 APR::Request::Brigade, and APR::Request::Brigade::IO packages.
27
29 APR::Request::Param
30
31 ""
32
33 "$param"
34
35 The double-quote interpolation operator maps to
36 "APR::Request::Param::value()".
37
39 APR::Request::Param
40
41 name
42
43 $param->name()
44
45 Returns the param's name. This attribute cannot be modified.
46
47 value
48
49 $param->value()
50
51 Returns the param's value. This attribute cannot be modified.
52
53 is_tainted
54
55 $param->is_tainted()
56 $param->is_tainted($set)
57
58 Get/set the param's internal tainted flag. Note: if the param's
59 charset is APREQ_CHARSET_UTF8 (8), this also activates the SvUTF8_on
60 flag during calls to name() and/or value().
61
62 $tainted = $param->is_tainted;
63 $param->is_tainted(0);
64 ok $param->is_tainted == 0;
65
66 charset
67
68 $param->charset()
69 $param->charset($set)
70
71 Get/set the param's internal charset. The charset is a number between
72 0 and 255; the current recognized values are
73
74 0 APREQ_CHARSET_ASCII (7-bit us-ascii)
75 1 APREQ_CHARSET_LATIN1 (8-bit iso-8859-1)
76 2 APREQ_CHARSET_CP1252 (8-bit Windows-1252)
77 8 APREQ_CHARSET_UTF8 (utf8 encoded Unicode)
78
79 See is_tainted above for info about how APREQ_CHARSET_UTF8 relates to
80 perl's UTF-8 flag.
81
82 $charset = $param->charset;
83 $param->charset(2);
84 ok $param->charset == 2;
85
86 make
87
88 APR::Request::Param->make($pool, $name, $value)
89
90 Fast XS param constructor.
91
92 info
93
94 $param->info()
95 $param->info($set)
96
97 Get/set the APR::Table headers for this param.
98
99 upload
100
101 $param->upload()
102 $param->upload($set)
103
104 Get/set the APR::Brigade file-upload content for this param.
105
106 upload_filename
107
108 $param->upload_filename()
109
110 Returns the client-side filename associated with this param.
111
112 upload_link
113
114 $param->upload_link($path)
115
116 Links the file-upload content with the local file named $path. Creates
117 a hard-link if the spoolfile's (see upload_tempname) temporary direc‐
118 tory is on the same device as $path; otherwise this writes a copy.
119
120 upload_slurp
121
122 $param->upload_slurp($data)
123
124 Reads the entire file-upload content into $data.
125
126 upload_size
127
128 $param->upload_size()
129
130 Returns the size of the param's file-upload content.
131
132 upload_type
133
134 $param->upload_type()
135
136 Returns the MIME-type of the param's file-upload content.
137
138 upload_tempname
139
140 $param->upload_tempname()
141
142 Returns the name of the local spoolfile for this param.
143
144 upload_io
145
146 $param->upload_io()
147
148 Returns an APR::Request::Brigade::IO object, which can be treated as a
149 non-seekable IO stream.
150
151 upload_fh
152
153 $param->upload_fh()
154
155 Returns a seekable filehandle representing the file-upload content.
156
158 APR::Request::Brigade
159
160 This class is derived from APR::Brigade, providing additional methods
161 for TIEHANDLE, READ and READLINE. To be memory efficient, these meth‐
162 ods delete buckets from the brigade as soon as their data is actually
163 read, so you cannot "seek" on handles tied to this class. Such handles
164 have semantics similar to that of a read-only socket.
165
166 new, TIEHANDLE
167
168 APR::Request::Brigade->TIEHANDLE($bb)
169
170 Creates a copy of the bucket brigade represented by $bb, and blesses
171 that copy into the APR::Request::Brigade class. This provides syntac‐
172 tic sugar for using perl's builtin "read", "readline", and "<>" opera‐
173 tions on handles tied to this package:
174
175 use Symbol;
176 $fh = gensym;
177 tie *$fh, "APR::Request::Brigade", $bb;
178 print while <$fh>;
179
180 READ
181
182 $bb->READ($contents)
183 $bb->READ($contents, $length)
184 $bb->READ($contents, $length, $offset)
185
186 Reads data from the brigade $bb into $contents. When omitted $length
187 defaults to "-1", which reads the first bucket into $contents. A posi‐
188 tive $length will read in $length bytes, or the remainder of the
189 brigade, whichever is greater. $offset represents the index in $context
190 to read the new data.
191
192 READLINE
193
194 $bb->READLINE()
195
196 Returns the first line of data from the bride. Lines are terminated by
197 linefeeds (the '\012' character), but we may eventually use $/ instead.
198
200 APR::Request::Brigade::IO
201
202 read
203
204 OO interface to APR::Request::Brigade::READ.
205
206 readline
207
208 OO interface to APR::Request::Brigade::READLINE.
209
211 APR::Request, APR::Table, APR::Brigade.
212
214 Licensed to the Apache Software Foundation (ASF) under one or more
215 contributor license agreements. See the NOTICE file distributed with
216 this work for additional information regarding copyright ownership.
217 The ASF licenses this file to You under the Apache License, Version 2.0
218 (the "License"); you may not use this file except in compliance with
219 the License. You may obtain a copy of the License at
220
221 http://www.apache.org/licenses/LICENSE-2.0
222
223 Unless required by applicable law or agreed to in writing, software
224 distributed under the License is distributed on an "AS IS" BASIS,
225 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
226 See the License for the specific language governing permissions and
227 limitations under the License.
228
229
230
231perl v5.8.8 2007-10-25 Param(3)