[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-modperl
Subject:    Re: Fixing Apache::ReadConfig limitations
From:       "John A." <john () ankarstrom ! se>
Date:       2021-04-16 22:29:03
Message-ID: s5d333$mqb$1 () ciao ! gmane ! io
[Download RAW message or body]

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!

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic