I am in the process of moving to modperl2 and was tripped up by the
problem with @PerlConfig that Apache2::PerlSections has. I came across
your post from last October but it does not look as though the fix you
suggested then has been taken up.

As per your post, there are two issues here affecting <Perl> sections
in httpd.conf:
a) @PerlConfig gets ignored.
b) If $PerlConfig (or an entry in @PerlConfig) is multi-line then it
does not get processed correctly (see page 422 of Writing Apache
Modules with Perl and C for examples that worked in mod perl 1).

Your suggested fix cured(a). I've extended your fix to cure (b) in a
way that seems to work for me.

The following is an extract from the config file in a freestanding
test module I created for this problem. It shows both of the issues
and the workaround.

# .....the following is the workaround that makes it work.
<Perl>
use Apache2::PerlSections;
BEGIN {
    *Apache2::PerlSections::dump_special = sub {
       my ($self, @data) = @_;
       foreach my $item (@data) {
          next unless defined $item;
          foreach my $line (split /\n/ , $item) {
            $self->add_config($line);
          }
       }
    }
}
</Perl>
#.....the following causes syntax error
<Perl>
   $PerlConfig  = "perlsetvar var1 1\n";
   $PerlConfig .= "perlsetvar var2 2\n";
</Perl>
#....the following is ignored
<Perl>
push @PerlConfig, <<EOF;
   perlsetvar varA A
   perlsetvar varB B
EOF
push @PerlConfig, <<EOF;
   perlsetvar varC C
   perlsetvar varD D
EOF
</Perl>


I didn't attach it here, but if anybody wants a copy of the test module
please ask.

--John




Reply via email to