📄 apache2::requestio.3
字号:
.el .IP "arg1: \f(CW$buffer\fR ( \s-1SCALAR\s0 )" 4.IX Item "arg1: $buffer ( SCALAR )".PDThe buffer to populate with the read data.ie n .IP "arg2: $len ( number )" 4.el .IP "arg2: \f(CW$len\fR ( number )" 4.IX Item "arg2: $len ( number )"How many bytes to attempt to read.ie n .IP "opt arg3: $offset ( number )" 4.el .IP "opt arg3: \f(CW$offset\fR ( number )" 4.IX Item "opt arg3: $offset ( number )"If a non-zero \f(CW$offset\fR is specified, the read data will be placed atthat offset in the \f(CW$buffer\fR..Sp\&\s-1META:\s0 negative offset and \e0 padding are not supported at the moment.ie n .IP "ret: $cnt ( number )" 4.el .IP "ret: \f(CW$cnt\fR ( number )" 4.IX Item "ret: $cnt ( number )"How many characters were actually read.ie n .IP "excpt: ""APR::Error""" 4.el .IP "excpt: \f(CWAPR::Error\fR" 4.IX Item "excpt: APR::Error".PD 0.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPThis method shares a lot of similarities with the Perl core \f(CW\*(C`read()\*(C'\fRfunction. The main difference in the error handling, which is done via\&\f(CW\*(C`APR::Error exceptions\*(C'\fR.ie n .Sh """rflush""".el .Sh "\f(CWrflush\fP".IX Subsection "rflush"Flush any buffered data to the client..PP.Vb 1\& $r\->rflush();.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.IP "ret: no return value" 4.IX Item "ret: no return value".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPUnless \s-1STDOUT\s0 stream's \f(CW$|\fR is false, data sent via\&\f(CW\*(C`$r\->print()\*(C'\fR is buffered. This method flushes thatdata to the client..ie n .Sh """sendfile""".el .Sh "\f(CWsendfile\fP".IX Subsection "sendfile"Send a file or a part of it.PP.Vb 3\& $rc = $r\->sendfile($filename);\& $rc = $r\->sendfile($filename, $offset);\& $rc = $r\->sendfile($filename, $offset, $len);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "arg1: $filename ( string )" 4.el .IP "arg1: \f(CW$filename\fR ( string )" 4.IX Item "arg1: $filename ( string )".PDThe full path to the file (using \f(CW\*(C`/\*(C'\fR on all systems).ie n .IP "opt arg2: $offset ( integer )" 4.el .IP "opt arg2: \f(CW$offset\fR ( integer )" 4.IX Item "opt arg2: $offset ( integer )"Offset into the file to start sending..SpNo offset is used if \f(CW$offset\fR is not specified..ie n .IP "opt arg3: $len ( integer )" 4.el .IP "opt arg3: \f(CW$len\fR ( integer )" 4.IX Item "opt arg3: $len ( integer )"How many bytes to send..SpIf not specified the whole file is sent (or a part of it, if\&\f(CW$offset\fR if specified).ie n .IP "ret: $rc\fR ( \f(CW""APR::Const status constant"" )" 4.el .IP "ret: \f(CW$rc\fR ( \f(CWAPR::Const status constant\fR )" 4.IX Item "ret: $rc ( APR::Const status constant )"On success,\&\f(CW\*(C`APR::Const::SUCCESS\*(C'\fR isreturned..SpIn case of a failure \*(-- a failure code is returned, in which casenormally it should be returned to the caller..ie n .IP "excpt: ""APR::Error""" 4.el .IP "excpt: \f(CWAPR::Error\fR" 4.IX Item "excpt: APR::Error"Exceptions are thrown only when this function is called in the \s-1VOID\s0context. So if you don't want to handle the errors, just don't ask fora return value and the function will handle all the errors on its own..IP "since: 2.0.00" 4.IX Item "since: 2.0.00".ie n .Sh """write""".el .Sh "\f(CWwrite\fP".IX Subsection "write"Send partial string to the client.PP.Vb 3\& $cnt = $r\->write($buffer);\& $cnt = $r\->write($buffer, $len);\& $cnt = $r\->write($buffer, $len, $offset);.Ve.ie n .IP "obj: $r\fR ( \f(CW""Apache2::RequestRec object"" )" 4.el .IP "obj: \f(CW$r\fR ( \f(CWApache2::RequestRec object\fR )" 4.IX Item "obj: $r ( Apache2::RequestRec object )".PD 0.ie n .IP "arg1: $buffer ( \s-1SCALAR\s0 )" 4.el .IP "arg1: \f(CW$buffer\fR ( \s-1SCALAR\s0 )" 4.IX Item "arg1: $buffer ( SCALAR )".PDThe string with data.ie n .IP "opt arg2: $len ( \s-1SCALAR\s0 )" 4.el .IP "opt arg2: \f(CW$len\fR ( \s-1SCALAR\s0 )" 4.IX Item "opt arg2: $len ( SCALAR )"How many bytes to send. If not specified, or \-1 is specified, all thedata in \f(CW$buffer\fR (or starting from \f(CW$offset\fR) will be sent..ie n .IP "opt arg3: $offset ( number )" 4.el .IP "opt arg3: \f(CW$offset\fR ( number )" 4.IX Item "opt arg3: $offset ( number )"Offset into the \f(CW$buffer\fR string..ie n .IP "ret: $cnt ( number )" 4.el .IP "ret: \f(CW$cnt\fR ( number )" 4.IX Item "ret: $cnt ( number )"How many bytes were sent (or buffered).ie n .IP "excpt: ""APR::Error""" 4.el .IP "excpt: \f(CWAPR::Error\fR" 4.IX Item "excpt: APR::Error".PD 0.IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PD.PPExamples:.PPAssuming that we have a string:.PP.Vb 1\& $string = "123456789";.Ve.PPThen:.PP.Vb 1\& $r\->write($string);.Ve.PPsends:.PP.Vb 1\& 123456789.Ve.PPWhereas:.PP.Vb 1\& $r\->write($string, 3);.Ve.PPsends:.PP.Vb 1\& 123.Ve.PPAnd:.PP.Vb 1\& $r\->write($string, 3, 5);.Ve.PPsends:.PP.Vb 1\& 678.Ve.PPFinally:.PP.Vb 1\& $r\->write($string, \-1, 5);.Ve.PPsends:.PP.Vb 1\& 6789.Ve.SH "TIE Interface".IX Header "TIE Interface"The \s-1TIE\s0 interface implementation. This interface is used for \s-1HTTP\s0request handlers, when running under \f(CW\*(C`SetHandlerperl\-script\*(C'\fR andPerl doesn't have perlio enabled..PPSee the \fIperltie\fR manpage for more information..ie n .Sh """BINMODE""".el .Sh "\f(CWBINMODE\fP".IX Subsection "BINMODE".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPNoOP.PPSee the \fIbinmode\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """CLOSE""".el .Sh "\f(CWCLOSE\fP".IX Subsection "CLOSE".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPNoOP.PPSee the \fIclose\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """FILENO""".el .Sh "\f(CWFILENO\fP".IX Subsection "FILENO".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIfileno\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """GETC""".el .Sh "\f(CWGETC\fP".IX Subsection "GETC".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIgetc\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """OPEN""".el .Sh "\f(CWOPEN\fP".IX Subsection "OPEN".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIopen\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """PRINT""".el .Sh "\f(CWPRINT\fP".IX Subsection "PRINT".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIprint\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """PRINTF""".el .Sh "\f(CWPRINTF\fP".IX Subsection "PRINTF".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIprintf\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """READ""".el .Sh "\f(CWREAD\fP".IX Subsection "READ".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIread\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """TIEHANDLE""".el .Sh "\f(CWTIEHANDLE\fP".IX Subsection "TIEHANDLE".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fItie\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """UNTIE""".el .Sh "\f(CWUNTIE\fP".IX Subsection "UNTIE".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPNoOP.PPSee the \fIuntie\fR Perl entry in the \fIperlfunc\fR manpage.ie n .Sh """WRITE""".el .Sh "\f(CWWRITE\fP".IX Subsection "WRITE".IP "since: 2.0.00" 4.IX Item "since: 2.0.00".PPSee the \fIwrite\fR Perl entry in the \fIperlfunc\fR manpage.SH "Deprecated API".IX Header "Deprecated API"The following methods are deprecated, Apache plans to remove those inthe future, therefore avoid using them..ie n .Sh """get_client_block""".el .Sh "\f(CWget_client_block\fP".IX Subsection "get_client_block"This method is deprecated since the C implementation is buggy and wedon't want you to use it at all. Instead use the plain\&\f(CW\*(C`$r\->read()\*(C'\fR..ie n .Sh """setup_client_block""".el .Sh "\f(CWsetup_client_block\fP".IX Subsection "setup_client_block"This method is deprecated since\&\f(CW\*(C`$r\->get_client_block\*(C'\fR is deprecated..ie n .Sh """should_client_block""".el .Sh "\f(CWshould_client_block\fP".IX Subsection "should_client_block"This method is deprecated since\&\f(CW\*(C`$r\->get_client_block\*(C'\fR is deprecated..SH "See Also".IX Header "See Also"mod_perl 2.0 documentation..SH "Copyright".IX Header "Copyright"mod_perl 2.0 and its core modules are copyrighted underThe Apache Software License, Version 2.0..SH "Authors".IX Header "Authors"The mod_perl development team and numerouscontributors.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -