The vast bulk of the functionality of the Perl API is contained in the Apache object. However, a number of auxiliary classes, including Apache::Table, Apache::Connection, and Apache::Server, provide additional methods for accessing and manipulating the state of the server. This section discusses these classes.
In the CGI environment, the standard input and standard output file descriptors are redirected so that data read and written is passed through Apache for processing. In the Apache module API, handlers ordinarily use the Apache read() and print() methods to communicate with the client. However, as a convenience, mod_perl ties the STDIN and STDOUT filehandles to the Apache class prior to invoking Perl API modules. This allows handlers to read from standard input and write to standard output exactly as if they were in the CGI environment.
The Apache class supports the full TIEHANDLE interface, as described in perltie(1). STDIN and STDOUT are already tied to Apache by the time your handler is called. If you wish to tie your own input or output filehandle, you may do so by calling tie() with the request object as the function's third parameter:
tie *BROWSER, 'Apache', $r; print BROWSER 'Come out, come out, wherever you are!';
Of course, it is better not to hardcode the Apache class name, as $r might be blessed into a subclass:
tie *BROWSER, ref $r, $r;
The Apache methods ...