![]() |
Practical mod_perl / HTML Book / | ![]() |
||
![]() |
||||
![]() |
![]() |
|||
![]() |
![]() |
|||
![]() |
||||
|
|
||||
![]() |
![]() |
|||
![]() |
5.8.3.2. Disabling code running under other handlers |
![]() |
||
![]() |
||||
![]() |
![]() |
![]() |
||
![]() |
||||
Under non-Apache::Registry handlers, you need to modify the configuration. You must either point all requests to a new location or replace the handler with one that will serve the requests during the maintenance period.
Example 5-2 illustrates a maintenance handler.
package Book::Maintenance;
use strict;
use Apache::Constants qw(:common);
sub handler {
my $r = shift;
$r->send_http_header("text/plain");
print qq{We regret that the service is temporarily
unavailable while essential maintenance is undertaken.
It is expected to be back online from 12:20 GMT.
Please be patient. Thank you!};
return OK;
}
1;
In practice, the maintenance script may well read the "back online" time from a variable set with a PerlSetVar directive in httpd.conf, so the script itself need never be changed.
Edit httpd.conf and change the handler line from:
<Location /perl>
SetHandler perl-script
PerlHandler Book::Handler
...
</Location>
to:
<Location /perl>
SetHandler perl-script
#PerlHandler Book::Handler
PerlHandler Book::Maintenance
...
</Location>
Now restart the server. Users will be happy to read their email for 10 minutes, knowing that they will return to a much improved service.
 
Continue to:
mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice
![]() |
Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.