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