Hi,
I am trying to get a container directive working. The code looks this
my @directives=( ... { name => '<ClickPathUAExceptions', func => __PACKAGE__ . '::ClickPathUAExceptions', req_override => Apache::RSRC_CONF, args_how => Apache::RAW_ARGS, errmsg => '<ClickPathUAExceptions> name1: regexp1 name2: regexp2 ... </ClickPathUAExceptions>', }, ... );
Apache recognizes the container correctly because it processes statements after the container but the ClickPathUAExceptions function is called with only one arg that contains the closing '>'.
That's the normal behaviour of RAW_ARGS, you get passed everything after the directive name on the line thru $args
How do I get the container contents?
By retrieving the Apache::Directive object:
sub ClickPathUAExceptions { my($self, $parms, $args) = @_; my $directive = $parms->directive; my $content = $directive->as_string; #Here is where you get at the contents of the directive. }
Of course, another more powerfull option is to use the more extensible <Perl> sections : <Perl handler="My::PerlSection::Handler" somearg="test1"> $foo = 1; $bar = 2; </Perl>
See http://perl.apache.org/docs/2.0/api/Apache/PerlSections.html#Advanced_API
[...]
-- -------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature