Presently, Apache::ReadConfig doesn't seem to provide a way to represent
the order of directives, which limits its usefulness when used with
modules like mod_rewrite that rely on the order of certain directives:

<VirtualHost "*:80">
    ServerName example.com
    DirectoryRoot /www
    <Directory "/www">
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule (.*) cgit.cgi/$1 [END,QSA]
    </Directory>
</VirtualHost>

This piece of configuration is (AFAIK?) impossible to create using
Apache::ReadConfig, because %VirtualHost and %Directory are unordered
hashes.

Assuming I'm correct about the problem, what could be done to fix it?

My personal idea is to create an additional module created
Apache::ReadConfig::Full (or something), which allows the following:

$Config->push(['VirtualHost', '*:80'] => block(
    ServerName => 'example.com',
    DirectoryRoot => '/www',
        ['Directory', '/www'] => block(
        RewriteEngine => On,
        RewriteCond => '%{REQUEST_FILENAME} !-f',
        RewriteCond => '%{REQUEST_FILENAME} !-d',
        RewriteRule => '(.*) cgit.cgi/$1 [END,QSA]'
    )
);

The `block' function creates an object that amounts to an ordered,
multi-value hash a la Hash::MultiValue. (The global $Config variable is
the same type of object.)

Before I start looking into the possibility of creating such an
interface, I thought I'd ask here whether my assumptions about
Apache::ReadConfig's limitations are correct.

Best regards
John

Reply via email to