During "response phase" dynamic document is created and sent to browser. This is also when CGI scripts run.
All CGI scripts will now load much faster. Example for srm.conf:
<Location /cgi-bin> SetHandler perl-script PerlHandler Apache::Registry PerlSendHeader On Options +ExecCGI </Location>
<Location /hello_perl>
SetHandler perl-script
PerlHandler Apache::Hello
</Location>
package Apache::Hello;
# file: Apache/Hello.pm
use strict vars;
use Apache::Constants ':common';
sub handler {
my $r = shift;
$r->content_type('text/html');
$r->send_http_header;
return OK if $r->header_only;
my $remote_host = $r->get_remote_host;
my $user_agent = $r->header_in('User-Agent');
$r->print(<<END);
<html>
<header>
<title>Greetings</title>
</header>
<body>
<h1>Greetings from Perl</h1>
<p> Hello to you, <b>$remote_host</b>.</p>
<p> You are the lucky user of a <i>$user_agent</i></p>
<hr>
END
$r->printf("<p>Path info = <b>%s</b></p><hr>\n",$r->path_info)
if $r->path_info;
$r->printf("<p>Query = <b>%s</b></p><hr>\n",$r->args)
if $r->args;
print <<END;
</body>
</html>
END
return OK;
}
1; |
|
| Contents | Next |