On Fri, 24 Aug 2001, Eric Hammond wrote:

> Is there any way to take the Apache::ReadConfig name space
> (variables set in <Perl> sections) and generate plain text
> Apache directives?

I don't know if there is a simple answer to this one, but the way I would
handle it is to scrap the Perl sections, and generate the entire config
file using a standalone perl script.  Then just change your apache start
script to first generate the config file, and then start Apache.  This way
you get the best of both worlds!  Your config file is dynamically
generated, and you can create a light apache without mod_perl.

Since you already have a half perl, half text config file, It would
probably be quite easy to use one of the many Template modules out there
to simplify this process...

I guess a module that does this automatically would be interesting, but it
would really only be useful to recover from some bad planning :)  (and I
guess we've all been there at one point or another)

Cees

> For example, assuming some_function() returns "myhost", I would
> like to convert the variables generated by:
> 
>         <Perl>
>         $ServerName = some_function();
>         $Port       = 80;
>         </Perl>
> 
> into:
> 
>         ServerName myhost
>         Port 80
> 
> I have a hypothetical situation where a friend of a friend spent
> a lot of time setting up a nice <Perl> configuration for an
> extended family of web servers with various requirements.  He
> then realized that one of the requirements was that some of the
> web servers run without mod_perl (to serve static files and proxy
> requests to separate mod_perl servers).
> 
> My hypothetical friend of a friend is very embarrassed.
> 
> After studying the instructions given in the Eagle book on how
> to convert plain directives into <Perl> variables, it seems that
> it should be possible to traverse the name space in Apache::ReadConfig
> and unwind the directives into something that standard mod_perl-less
> Apache could process.
> In fact, I have embarked on a project to build just such a tool.
> 
> Before I go too far, though, I thought it would be helpful to seek
> wisdom here.  Perhaps somebody else has already done this?
> Perhaps mod_perl already has the code embedded in it that could
> be used?  Perhaps some wish to tell me it is near impossible in
> the general case and I should abandon my foolish quest?
> 
> Of course, I realize that the output generated will not be able
> to duplicate any side-effects or dynamic nature of code in the <Perl>
> sections.  One of the requirements for using this utility will be
> that you only need the end results stored in Apache::ReadConfig.
> 
> I would be interested in suggestions for package naming if I do
> succeed to an extent that others might be interested in using it.
> Should I create a new method in the Apache::PerlSections name space
> or would this be stepping on Doug's toes?
> 
> Please do let me know if anybody else has a use for such a tool.
> This will help me figure out how much time I should spend trying to
> handle the general cases instead of just writing it to meet my...
> er, my friend's... specific needs.
> 
> Thanks
> --
> Eric Hammond
> [EMAIL PROTECTED]
> 

-- 
Cees Hek
SiteSuite Corporation
[EMAIL PROTECTED]

Reply via email to