Show Contents Previous Page Next Page Chapter 8 - Customizing the Apache Configuration Process / The Apache Configuration Directive API We'll now look in more detail at how you can precisely control the behavior of configuration directives.
As you recall, a module's configuration directives are declared in an array of hashes passed to the command_table() function. Each hash contains the required keys, For example, this code fragment defines two configuration directives named TrafficCopSpeedLimit and TrafficCopRightOfWay: @directives = (
{
name => 'TrafficCopSpeedLimit',
errmsg => 'an integer specifying the maximum allowable
kilobytes per second',
func => 'right_of_way',
args_how => 'TAKE1',
req_override => 'OR_ALL',
},
{
name => 'TrafficCopRightOfWay',
errmsg => 'list of domains that can go as fast as they
want',
args_how => 'ITERATE',
req_override => 'OR_ALL',
cmd_data => '[A-Z_]+',
},
);
command_table(\@directives);
The required
The mandatory
The optional
The optional sub TrafficCopRightOfWay ($$@) {
my($cfg, $parms, $domain) = @_;
my $pat = $parms->info;
unless ($domain =~ /^$pat$/i) {
die "Invalid domain: $domain\n";
}
$cfg->{RightOfWay}{$domain}++;
}
Copyright © 1999 by O'Reilly & Associates, Inc. |
HIVE: All information for read only. Please respect copyright! |