Re: Apache2::PerlSections $PerlConfig

"Philippe M. Chiasson" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 11-11-21 09:49 , Perrin Harkins wrote:
> On Mon, Nov 21, 2011 at 9:03 AM, Josh Narins <[email protected]> wrote:
>> So, different ways to get this config to apache include:
>>
>> my $r = Apache2::RequestUtil->request;
>> $r->add_config($template->output);
>>
>> But that results in the error "Global $r object is not available." and the server does not start.
>
> Yes, that's what I was getting at: there's no request during startup
> when your httpd.conf is being processes, so there's no $r object to
> get.
> 
> I don't use this config stuff at all, but looking in the docs I think
> this might work for you:
> 
> use Apache2::ServerUtil ();
> $s = Apache2::ServerUtil->server;
> $s->add_config($config);

You can also use the simpler :

Apache2->httpd_conf("SetEnv foo");

> - Perrin
>> The other two, similar, ways I know about involve $PerlConfig and @PerlConfig, and while neither prevents server startup, Apache2::Directive shows that they didn't do anything, with or without the hack mentioned by Randal here:
>>
>> http://www.gossamer-threads.com/lists/modperl/modperl/85304?do=post_view_threaded#85304
>>
>> And, just so we are all sure, $template->output produces both the content I expect and content that works to start the server. If I simply replace the <Perl> section with the generated output the server starts.

Have you read
<http://perl.apache.org/docs/2.0/api/Apache2/PerlSections.html#C_server_>.
The <Perl> section stuff was re-implemented from scratch between v1 and
v2, so this might be some bug.

Have you tried adding this:

 <Perl>
  print Apache2::PerlSections->dump;
 </Perl>

To the bottom of your httpd.conf, so see what gets dumped ?

Also, it would greatly help if you could post a complete example
httpd.conf (even if simplified) that demonstrates the problem you are
having.

-- 
Philippe M. Chiasson     GPG: F9BFE0C2480E7680 1AE53631CB32A107 88C3A5A5
http://gozer.ectoplasm.org/       m/gozer\@(apache|cpan|ectoplasm)\.org/
signature.asc (application/pgp-signature, 259 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7KvvwACgkQyzKhB4jDpaXHRACePqiCjYP2x1B7Gkdt5vibiAIH
USQAoIdMBsyK/37n94bUj7jeCFuUKavJ
=hzFe
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.