Re: How does Apache::RAW_ARGS work?

[prev] [thread] [next] [Date index for 2004/12/12]

From: Philippe M. Chiasson
Subject: Re: How does Apache::RAW_ARGS work?
Date: 23:55 on 12 Dec 2004
--------------enig9B54CDC37BD2E0AACCB77726
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Torsten Foertsch wrote:
> 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

--------------enig9B54CDC37BD2E0AACCB77726
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBvNpzyzKhB4jDpaURAuvpAKC8ojkKUy0IxRzg9bOhMmjSayNdeACgmEYw
9svVNPd7ANLqz9CznGL+FOY=
=pgRz
-----END PGP SIGNATURE-----

--------------enig9B54CDC37BD2E0AACCB77726--

How does Apache::RAW_ARGS work?
Torsten Foertsch 21:17 on 12 Dec 2004

Re: How does Apache::RAW_ARGS work?
Philippe M. Chiasson 23:55 on 12 Dec 2004

Re: How does Apache::RAW_ARGS work?
Torsten Foertsch 08:31 on 13 Dec 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52