📄 apr::request.3
字号:
matching body param. In list context it returns all matching body params..PP\&\fIbody()\fR will throw an APR::Request::Error object whenever \fIbody_status()\fR is non-zero and the return value is potentially invalid (eg \&\f(CW\*(C`scalar $req\->body($key)\*(C'\fR will not die if the desired body param wassuccessfully parsed)..PP.Vb 4\& $body = $req\->body;\& @body_names = $req\->body;\& ok $body\->isa("APR::Request::Param::Table");\& ok shift @body_names eq $_ for keys %$body;\&\& $alpha = $req\->body("alpha");\& @beta = $req\->body("beta");.Ve.Sh "param".IX Subsection "param".Vb 2\& $req\->param()\& $req\->param($key).Ve.PPWith no arguments, this method returns a tied APR::Request::Param::Tableobject (or undef, if the query string and request body are absent) in scalarcontext, or the names (in order, with repetitions) of all the incoming(args + body) params..PPWith the \f(CW$key\fR argument, in scalar context this method fetches the firstmatching param. In list context it returns all matching params..PP\&\fIparam()\fR will throw an APR::Request::Error object whenever \fIparam_status()\fR is non-zero and the return value is potentially invalid (eg \&\f(CW\*(C`scalar $req\->param($key)\*(C'\fR will not die if the desired param was successfully parsed)..PP.Vb 4\& $param = $req\->param;\& @param_names = $req\->param;\& ok $param\->isa("APR::Request::Param::Table");\& ok shift @param_names eq $_ for keys %$param;\&\& $foo = $req\->param("foo");\& @foo = $req\->param("foo");.Ve.Sh "upload".IX Subsection "upload".Vb 2\& $req\->upload()\& $req\->upload($key).Ve.PPWith no arguments, this method returns a tied APR::Request::Param::Tableobject (or undef if the request body is absent) in scalar context (whoseentries are APR::Request::Param objects), or the names (in order, with repetitions) of all the incoming uploads..PPWith the \f(CW$key\fR argument, in scalar context this method fetches the firstmatching upload. In list context it returns all matching uploads. The returnvalues are APR::Request::Param objects..PP\&\fIupload()\fR will throw an APR::Request::Error object whenever \fIbody_status()\fR is non-zero..PP.Vb 5\& $uploads = $req\->upload;\& @upload_names = $req\->upload;\& ok $uploads\->isa("APR::Request::Param::Table");\& ok shift @upload_names eq $_ for keys %$uploads;\& ok $_\->upload for values %$uploads;\&\& $up = $req\->upload("beta");\& @ups = $req\->upload("beta");\& ok $_\->isa("APR::Request::Param") for $up, @ups;\& ok $_\->upload for $up, @ups;.Ve.Sh "read_limit".IX Subsection "read_limit".Vb 2\& $req\->read_limit()\& $req\->read_limit($set).Ve.PPGet/set the read limit, which controls the total amount ofbytes that can be fed to the current parser..Sh "brigade_limit".IX Subsection "brigade_limit".Vb 2\& $req\->brigade_limit()\& $req\->brigade_limit($set).Ve.PPGet/set the brigade_limit for the current parser. This limitdetermines how many bytes of a file upload that the parser mayspool into main memory. Uploads exceeding this limit are writtendirectly to disk..Sh "temp_dir".IX Subsection "temp_dir".Vb 2\& $req\->temp_dir()\& $req\->temp_dir($set).Ve.PPGet/set the spool directory for uploads which exceed the configuredbrigade_limit..Sh "disable_uploads".IX Subsection "disable_uploads".Vb 1\& $req\->disable_uploads().Ve.PPEngage the disable_uploads hook for this request..Sh "upload_hook".IX Subsection "upload_hook".Vb 1\& $req\->upload_hook($callback).Ve.PPAdd an upload hook callback for this request. Thearguments to the \f(CW$callback\fR sub are ($upload, \f(CW$new_data\fR)..Sh "import".IX Subsection "import"Exports a list of subs into the caller's package..SH "SUBROUTINES".IX Header "SUBROUTINES"APR::Request.Sh "encode".IX Subsection "encode".Vb 1\& encode($string).Ve.PPExportable sub which returns the url-encoded form of \f(CW$string\fR..Sh "decode".IX Subsection "decode".Vb 1\& decode($string).Ve.PPExportable sub which returns the url-decoded form of \f(CW$string\fR..SH "SUBCLASSING".IX Header "SUBCLASSING"APR::Request.PPIf the instances of your subclass are hash references then you can actuallyinherit from APR::Request as long as the APR::Request object is stored inan attribute called \*(L"r\*(R" or \*(L"_r\*(R". (The APR::Request class effectively does thedelegation for you automagically, as long as it knows where to find theAPR::Request object to delegate to.) For example:.PP.Vb 7\& package MySubClass;\& use APR::Request::Custom;\& our @ISA = qw(APR::Request);\& sub new {\& my($class, @args) = @_;\& return bless { r => APR::Request::Custom\->handle(@args) }, $class;\& }.Ve.SH "METHODS".IX Header "METHODS".Vb 1\& APR::Request::Cookie::Table \- read\-only version of APR::Table..Ve.PPTables in this class normally arise from calls to\&\f(CW\*(C`APR::Request::jar()\*(C'\fR..Sh "cookie_class".IX Subsection "cookie_class".Vb 2\& $table\->cookie_class()\& $table\->cookie_class($set).Ve.PPGet/set the class each table element is blessed into during aget or \s-1FETCH\s0 call. If defined, the class must be derivedfrom APR::Request::Cookie. When called with \f(CW$set\fR, it returnsthe \f(CW$table\fR. Otherwise it returns the name of the current class,or undef if no cookie class is defined..Sh "get".IX Subsection "get".Vb 1\& $table\->get($key).Ve.PPSame as \s-1FETCH\s0..Sh "\s-1FETCH\s0".IX Subsection "FETCH".Vb 1\& $table\->FETCH($key).Ve.PPIn scalar context, this returns the first value matching\&\f(CW$key\fR (note: see \s-1NEXTKEY\s0 for additional notes). The matchis always case-insensitive. In list context, this returnsall matching values. Note: the type of the return valuesdepends on the table's current cookie_class..Sh "\s-1EXISTS\s0".IX Subsection "EXISTS"Synonym for \f(CW\*(C`defined\*(C'\fR; these tables are notallowed to contain undefined values. Since theseare constant tables, they don't autovivify either..Sh "\s-1FIRSTKEY\s0".IX Subsection "FIRSTKEY".Vb 1\& $table\->FIRSTKEY().Ve.PPReturns the first key in the table..Sh "\s-1NEXTKEY\s0".IX Subsection "NEXTKEY".Vb 1\& $table\->NEXTKEY().Ve.PPReturns the next key in the table. For perl 5.8+,if the key is multivalued, a subsequent \s-1FETCH\s0 onthis key will return the corresponding value, untileither \s-1NEXTKEY\s0 or \s-1FIRSTKEY\s0 is invoked again. Forperl 5.6, \s-1FETCH\s0 always returns the first value..Sh "do".IX Subsection "do".Vb 1\& $table\->do($callback, @keys).Ve.PPSame as APR::Table::do; iterates over the tablecalling \f(CW$callback\fR\->($key, \f(CW$value\fR) for each matching\&\f(CW@keys\fR. If \f(CW@keys\fR is empty, this iterates over theentire table..PPNote: The type of \f(CW$value\fR inserted into the callbackdepends on the table's current cookie_class..SH "METHODS".IX Header "METHODS"APR::Request::Param::Table.Sh "param_class".IX Subsection "param_class".Vb 2\& $table\->param_class()\& $table\->param_class($set).Ve.PPGet/set the class each table element is blessed into during a\&\f(CW\*(C`get\*(C'\fR or \f(CW\*(C`FETCH\*(C'\fR call. If defined, the class must be derivedfrom APR::Request::Param. When called with \f(CW$set\fR, it returnsthe \f(CW$table\fR. Otherwise it returns the name of the current class,or undef if no param class is defined..Sh "get".IX Subsection "get".Vb 1\& $table\->get($key).Ve.PPSame as \s-1FETCH\s0..Sh "\s-1FETCH\s0".IX Subsection "FETCH".Vb 1\& $table\->FETCH($key).Ve.PPIn scalar context, this returns the first value matching\&\f(CW$key\fR (see \s-1NEXTKEY\s0 for additional notes on this). The matchis always case-insensitive. In list context, this returnsall matching values. Note: the type of the return valuesdepends on the table's current param_class..Sh "\s-1EXISTS\s0".IX Subsection "EXISTS"Synonym for \f(CW\*(C`defined\*(C'\fR; these tables are notallowed to contain undefined values. Since theseare constant tables, they don't autovivify either..Sh "\s-1NEXTKEY\s0".IX Subsection "NEXTKEY".Vb 1\& $table\->NEXTKEY().Ve.PPReturns the next key in the table. For perl 5.8+,if the key is multivalued, a subsequent \s-1FETCH\s0 onthis key will return the corresponding value, untileither \s-1NEXTKEY\s0 or \s-1FIRSTKEY\s0 is invoked again. Forperl 5.6, \s-1FETCH\s0 always returns the first value..Sh "\s-1FIRSTKEY\s0".IX Subsection "FIRSTKEY".Vb 1\& $table\->FIRSTKEY().Ve.PPReturns the first key in the table..Sh "do".IX Subsection "do".Vb 1\& $table\->do($callback, @keys).Ve.PPSame as APR::Table::do; iterates over the tablecalling \f(CW$callback\fR\->($key, \f(CW$value\fR) for each matching\&\f(CW@keys\fR. If \f(CW@keys\fR is empty, this iterates over theentire table..PPNote: The type of \f(CW$value\fR inserted into the callbackdepends on the table's current value_class..SH "SEE ALSO".IX Header "SEE ALSO"APR::Request::Error, APR::Request::Param,APR::Request::Cookie, APR::Request::Parser.SH "COPYRIGHT".IX Header "COPYRIGHT".Vb 1\& Copyright 2003\-2006 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..Ve.SH "POD ERRORS".IX Header "POD ERRORS"Hey! \fBThe above document had some coding errors, which are explained below:\fR.IP "Around line 6:" 4.IX Item "Around line 6:"\&'=begin' only takes one parameter, not several as in '=begin testing use APR::Pool; use APR::Brigade; use APR::Bucket; use APR::BucketAlloc; use APR::Request; use APR::Request::Parser; \f(CW$pool\fR = APR::Pool\->new; \f(CW$ba\fR = APR::BucketAlloc\->new($pool); \f(CW$bb\fR = APR::Brigade\->new($pool, \f(CW$ba\fR); \f(CW$content\fR = <<\s-1EOT\s0; \-\-\-XYZ\- Content-Disposition: form-data; name=\*(L"alpha\*(R" Content-Type: text/plain; charset=us\-ascii'.IP "Around line 39:" 4.IX Item "Around line 39:"=end testing without matching =begin. (Stack: [empty])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -