docs::api::Apache2::RequestIO - Online Linux Manual PageSection : 3
Updated : 2021-01-26
Source : perl v5.32.1
Note : User Contributed Perl Documentation

NAMEApache2::RequestIO − Perl API for Apache request record IO

Synopsis​ use Apache2::RequestIO (); ​ ​ $rc = $r−>discard_request_body(); ​ ​ $r−>print("foo", "bar"); ​ $r−>puts("foo", "bar"); # same as print, but no flushing ​ $r−>printf("%s $d", "foo", 5); ​ ​ $r−>read($buffer, $len); ​ ​ $r−>rflush(); ​ ​ $r−>sendfile($filename); ​ ​ $r−>write("foobartarcar", 3, 5);

DescriptionApache2::RequestIO provides the API to perform IO on the Apache request object.

APIApache2::RequestIO provides the following functions and/or methods:

discard_request_bodyIn HTTP/1.1, any method can have a body. However, most GET handlers wouldn't know what to do with a request body if they received one. This helper routine tests for and reads any message body in the request, simply discarding whatever it receives. We need to do this because failing to read the request body would cause it to be interpreted as the next request on a persistent connection. ​ $rc = $r−>discard_request_body(); obj: $r ( Apache2::RequestRec object ) The current request ret: $rc ( integer ) APR::Const status constant if request is malformed, Apache2::Const::OK otherwise. since: 2.0.00 Since we return an error status if the request is malformed, this routine should be called at the beginning of a no-body handler, e.g., ​ use Apache2::Const −compile => qw(OK); ​ $rc = $r−>discard_request_body; ​ return $rc if $rc != Apache2::Const::OK;

printSend data to the client. ​ $cnt = $r−>print(@msg); obj: $r ( Apache2::RequestRec object ) arg1: @msg ( ARRAY ) Data to send ret: $cnt ( number ) How many bytes were sent (or buffered). If zero bytes were sent, print will return 0E0, or zero but true, which will still evaluate to 0 in a numerical context. excpt: APR::Error since: 2.0.00 The data is flushed only if STDOUT stream's $| is true. Otherwise it's buffered up to the size of the buffer, flushing only excessive data.

printfFormat and send data to the client (same as printf). ​ $cnt = $r−>printf($format, @args); obj: $r ( Apache2::RequestRec object ) arg1: $format ( string ) Format string, as in the Perl core printf function. arg2: @args ( ARRAY ) Arguments to be formatted, as in the Perl core printf function. ret: $cnt ( number ) How many bytes were sent (or buffered) excpt: APR::Error since: 2.0.00 The data is flushed only if STDOUT stream's $| is true. Otherwise it's buffered up to the size of the buffer, flushing only excessive data.

putsSend data to the client ​ $cnt = $r−>puts(@msg); obj: $r ( Apache2::RequestRec object ) arg1: @msg ( ARRAY ) Data to send ret: $cnt ( number ) How many bytes were sent (or buffered) excpt: APR::Error since: 2.0.00 puts() is similar to print(), but it won't attempt to flush data, no matter what the value of STDOUT stream's $| is. Therefore assuming that STDOUT stream's $| is true, this method should be a tiny bit faster than print(), especially if small strings are printed.

readRead data from the client. ​ $cnt = $r−>read($buffer, $len); ​ $cnt = $r−>read($buffer, $len, $offset); obj: $r ( Apache2::RequestRec object ) arg1: $buffer ( SCALAR ) The buffer to populate with the read data arg2: $len ( number ) How many bytes to attempt to read opt arg3: $offset ( number ) If a non-zero $offset is specified, the read data will be placed at that offset in the $buffer. META: negative offset and \0 padding are not supported at the moment ret: $cnt ( number ) How many characters were actually read excpt: APR::Error since: 2.0.00 This method shares a lot of similarities with the Perl core read() function. The main difference in the error handling, which is done via ​APR::Error exceptions

rflushFlush any buffered data to the client. ​ $r−>rflush(); obj: $r ( Apache2::RequestRec object ) ret: no return value since: 2.0.00 Unless STDOUT stream's $| is false, data sent via ​$r−>print() is buffered. This method flushes that data to the client.

sendfileSend a file or a part of it ​ $rc = $r−>sendfile($filename); ​ $rc = $r−>sendfile($filename, $offset); ​ $rc = $r−>sendfile($filename, $offset, $len); obj: $r ( Apache2::RequestRec object ) arg1: $filename ( string ) The full path to the file (using / on all systems) opt arg2: $offset ( integer ) Offset into the file to start sending. No offset is used if $offset is not specified. opt arg3: $len ( integer ) How many bytes to send. If not specified the whole file is sent (or a part of it, if ​$offset if specified) ret: $rc ( APR::Const status constant ) On success, ​APR::Const::SUCCESS is returned. In case of a failure \*(-- a failure code is returned, in which case normally it should be returned to the caller. excpt: APR::Error Exceptions are thrown only when this function is called in the VOID context. So if you don't want to handle the errors, just don't ask for a return value and the function will handle all the errors on its own. since: 2.0.00 

writeSend partial string to the client ​ $cnt = $r−>write($buffer); ​ $cnt = $r−>write($buffer, $len); ​ $cnt = $r−>write($buffer, $len, $offset); obj: $r ( Apache2::RequestRec object ) arg1: $buffer ( SCALAR ) The string with data opt arg2: $len ( SCALAR ) How many bytes to send. If not specified, or −1 is specified, all the data in $buffer (or starting from $offset) will be sent. opt arg3: $offset ( number ) Offset into the $buffer string. ret: $cnt ( number ) How many bytes were sent (or buffered) excpt: APR::Error since: 2.0.00 Examples: Assuming that we have a string: ​ $string = "123456789"; Then: ​ $r−>write($string); sends: ​ 123456789 Whereas: ​ $r−>write($string, 3); sends: ​ 123 And: ​ $r−>write($string, 3, 5); sends: ​ 678 Finally: ​ $r−>write($string, −1, 5); sends: ​ 6789

TIE InterfaceThe TIE interface implementation. This interface is used for HTTP request handlers, when running under SetHandler perl−script and Perl doesn't have perlio enabled. See the perltie manpage for more information.

BINMODEsince: 2.0.00 NoOP See the binmode Perl entry in the perlfunc manpage

CLOSEsince: 2.0.00 NoOP See the close Perl entry in the perlfunc manpage

FILENOsince: 2.0.00 See the fileno Perl entry in the perlfunc manpage

GETCsince: 2.0.00 See the getc Perl entry in the perlfunc manpage

OPENsince: 2.0.00 See the open Perl entry in the perlfunc manpage

PRINTsince: 2.0.00 See the print Perl entry in the perlfunc manpage

PRINTFsince: 2.0.00 See the printf Perl entry in the perlfunc manpage

READsince: 2.0.00 See the read Perl entry in the perlfunc manpage

TIEHANDLEsince: 2.0.00 See the tie Perl entry in the perlfunc manpage

UNTIEsince: 2.0.00 NoOP See the untie Perl entry in the perlfunc manpage

WRITEsince: 2.0.00 See the write Perl entry in the perlfunc manpage

Deprecated APIThe following methods are deprecated, Apache plans to remove those in the future, therefore avoid using them.

get_client_blockThis method is deprecated since the C implementation is buggy and we don't want you to use it at all. Instead use the plain ​$r−>read().

setup_client_blockThis method is deprecated since ​$r−>get_client_block is deprecated.

should_client_blockThis method is deprecated since ​$r−>get_client_block is deprecated.

See Alsomod_perl 2.0 documentation.

Copyrightmod_perl 2.0 and its core modules are copyrighted under The Apache Software License, Version 2.0.

AuthorsThe mod_perl development team and numerous contributors.
0
Johanes Gumabo
Data Size   :   51,323 byte
man-Apache2::RequestIO.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 171,165
Visitor ID   :     :  
Visitor IP   :   18.226.186.109   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Apache2::RequestIO.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Apache2::RequestIO.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|Apache2::RequestIO.3pm|43|br══─}─══|'br══─}─══ )         (htmlprn|149|Apache2::RequestIO.3pm|43|'br══─}─══ |'br══─}─══ )         (rof_escape_sequence|91|Apache2::RequestIO.3pm|410|\*(-- a failure code is returned, in which case |In case of a failure \*(-- a failure code is returned, in which case )