Overriding a built-in Apache configuration directive using mod_perl
Matisse Enzer <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Is it practical to override a built-in Apache config directive such as 'Require' in a mod_perl Apache module?
I have examined the documentation at:
http://perl.apache.org/docs/2.0/user/config/custom.html#Creating_and_Using_Custom_Configuration_Directives
and it seems like it might work, but I'd like to hear others' opinions before starting work on it.
So, for example, can I have our Apache module provide a custom version of the 'Require' directive, approximately like this:
# Example of overriding 'Require' in a mod_perl Apache module
#
my @directives = (
{ name => 'Require',
func => __PACKAGE__ . '::Require',
req_override => Apache2::Const::OR_ALL,
args_how => Apache2::Const::ITERATE,
errmsg => 'Require Entry1 [Entry2 ... [EntryN]]',
},
);
Apache2::Module::add( __PACKAGE__, \@directives );
sub Require {
my ( $self, $parms, $type, @args ) = @_;
my @translated_args = ($type);
# Custom manipulations of arguments
foreach my $old_style_arg (@args) {
my $new_style_arg
= $self->translate_arg($old_style_arg) push $new_style_arg,
@translated_args;
}
$self->{'Require'} = \@translated_args;
}