27 lines
541 B
Plaintext
27 lines
541 B
Plaintext
|
|
|
|
###
|
|
### define_config_directive
|
|
###
|
|
|
|
## Chapter 2 section 1.2
|
|
|
|
sub define_config_directive {
|
|
my $rest = shift;
|
|
$rest =~ s/^\s+//;
|
|
my ($new_directive, $def_txt) = split /\s+/, $rest, 2;
|
|
|
|
if (exists $CONFIG_DIRECTIVE_TABLE{$new_directive}) {
|
|
warn "$new_directive already defined; skipping.\n";
|
|
return;
|
|
}
|
|
|
|
my $def = eval "sub { $def_txt }";
|
|
if (not defined $def) {
|
|
warn "Could not compile definition for `$new_directive': $@; skipping.\n";
|
|
return;
|
|
}
|
|
|
|
$CONFIG_DIRECTIVE_TABLE{$new_directive} = $def;
|
|
}
|