Re: Fixing Apache::ReadConfig limitations

"John A." <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Den 2021-04-16 kl. 23:30 skrev John A.:
> Den 2021-04-16 kl. 20:42 skrev Mithun Bhattacharya:
>> Doesnt it accept array of array refs for this purpose ?
> 
> Could you give an example? I'm not sure I follow.

Replying to myself with an update, as I seem to have figured it out!

I saw Tie::IxHash mentioned somewhere and then found a note in the
mod_perl Developer's Cookbook about Tie::DxHash, which provides ordered,
multi-value hashes.

And indeed, the following code appears to work perfectly:

use Tie::DxHash;

sub block {
        my %hash;
        tie %hash, 'Tie::DxHash';
        %hash = @_;
        return \%hash;
}

$VirtualHost{'*:80'} = {
        ServerName => 'git.ankarstrom.se',
        DocumentRoot => '/usr/local/www/git/data',
        Directory => {
                '/usr/local/www/git/data' => block(
                        DirectoryIndex => 'cgit.cgi',
                        Options => 'FollowSymLinks ExecCGI',
                        RewriteEngine => 'On',
                        RewriteCond => '%{REQUEST_FILENAME} !-f',
                        RewriteCond => '%{REQUEST_FILENAME} !-d',
                        RewriteRule => '(.*) cgit.cgi/$1 [END,QSA]',
                        Require => 'all granted'
                )
        }
};

Neat!
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.