You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Fabien COELHO <co...@cri.ensmp.fr> on 2001/01/30 11:55:57 UTC

mod_macro inclusion in apache 2.0

Hello little and big endians of the apache tribe,

As the new apache 2.0 version is making its path for a beta version some
day, with many rewritings and improvements and so on, I wish the inclusion
of the small mod_macro module in apache core distribution could be
discussed.

The purpose of the module I wrote 2 years ago is not extra better great
magic performances with multi threaded shared memory marvellous processes,
but just to ease poor administrator configuration tasks with the help of
basic macros that have been proven useful.

See http://www.cri.ensmp.fr/~coelho/mod_macro/ for a summary of features.
Basically, you can define a macro within <Macro> tags, and use them
afterwards with a Use keyword. A lot of effort where made so as to locate
correctly errors when macros are used within a configuration file.

<Macro MyVirtualHost $dir $name>
  <VirtualHost $name>
    DocumentRoot $dir
    ...
  </VirtualHost>
</Macro>

Use MyVirtualHost /home/apache www.apache.org
Use MyVirtualHost /home/jakarta jakarta.apache.org
Use MyVirtualHost /home/perl perl.apache.org


The module can stand a little bit of rewriting so as to warrant thread
safety, but anyway the principle of its inclusion could be decided.

Have a nice day,

-- 
Fabien.


Re: mod_macro inclusion in apache 2.0

Posted by Fabien COELHO <co...@cri.ensmp.fr>.
Hello,

> Its been said before, but I'll say it again: there are many tools that
> allow you to do this independently of Apache, e.g. sed, m4, awk, perl -
> why invent another inside Apache?

You forgot cpp;-)

 - sed is line oriented. 
   I cannot see how you can use it simply to manage macros. 

 - perl and awk are programming languages, not configuration tools.
   I'm not playing on words. I don't see why I should have to 
   program perl stuff as a help to apache configuration.

 - preprocessors like cpp/m4 need assumptions about the lexical structure
   of the file being processed. cpp cannot be used (you cannot have
   multi line macros with cpp). The m4 escape mecanism is quite unusual
   with ` ' sections, and the syntax and approach is quite far from 
   apache configuration files, and you need to master them.

As I outlined in the message, integration allows a clean interface for
reporting syntax errors when macros are involved. Also it allows people
not to fix the same problem over and over on their own as the problem is
solved once for the community in a portable way. 

> If you really want to do something Apache-specific for this, I'd
> suggest a really nifty perl module, though it is totally unclear to me 
> what you are offering over trivial substitution.

Yes, the module offers trivial simple basic substitution. 

I don't see that as a problem;-)

If you want to keep with your logic, you can simplify apache configuration
by dropping <IfModule and other <IfDefine as the same stuff can be done
with perl/awk/sed/m4/cpp. Also Include looks pretty useless, as
perl/sed/m4/cpp/python does it perfectly. 

-- 
Fabien Coelho ___ coelho@cri.ensmp.fr ___ http://www.cri.ensmp.fr/~coelho



Re: mod_macro inclusion in apache 2.0

Posted by Ben Laurie <be...@algroup.co.uk>.
Fabien COELHO wrote:
> 
> Hello little and big endians of the apache tribe,
> 
> As the new apache 2.0 version is making its path for a beta version some
> day, with many rewritings and improvements and so on, I wish the inclusion
> of the small mod_macro module in apache core distribution could be
> discussed.
> 
> The purpose of the module I wrote 2 years ago is not extra better great
> magic performances with multi threaded shared memory marvellous processes,
> but just to ease poor administrator configuration tasks with the help of
> basic macros that have been proven useful.
> 
> See http://www.cri.ensmp.fr/~coelho/mod_macro/ for a summary of features.
> Basically, you can define a macro within <Macro> tags, and use them
> afterwards with a Use keyword. A lot of effort where made so as to locate
> correctly errors when macros are used within a configuration file.
> 
> <Macro MyVirtualHost $dir $name>
>   <VirtualHost $name>
>     DocumentRoot $dir
>     ...
>   </VirtualHost>
> </Macro>
> 
> Use MyVirtualHost /home/apache www.apache.org
> Use MyVirtualHost /home/jakarta jakarta.apache.org
> Use MyVirtualHost /home/perl perl.apache.org
> 
> The module can stand a little bit of rewriting so as to warrant thread
> safety, but anyway the principle of its inclusion could be decided.

Its been said before, but I'll say it again: there are many tools that
allow you to do this independently of Apache, e.g. sed, m4, awk, perl -
why invent another inside Apache?

If you really want to do something Apache-specific for this, I'd suggest
a really nifty perl module, though it is totally unclear to me what you
are offering over trivial substitution.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff