gpg: failed to create temporary file '/var/lib/lurker/.#lk0x569db100.hantslug.org.uk.9320': Permission denied
gpg: keyblock resource '/var/lib/lurker/pubring.gpg': Permission denied
gpg: Signature made Sat Nov 24 01:53:29 2007 GMT
gpg:                using DSA key 2099B64CBF15490B
gpg: Can't check signature: No public key
Hi Graham,
On Sat, Nov 17, 2007 at 06:34:44PM +0000, Graham Bleach wrote:
> On 17/11/2007, Andy Smith <andy@???> wrote:
> > I'm attempting to write a mod_perl (registry) application and would
> > like to parse a config file once per (web) server startup.  I want
> > to avoid hard coding the path to the config file in the startup
> > script.
> 
> The most promising reference I can find is [1]. In the
> PerlPostConfigHandler section it states:
> 
> "You can do the same in the startup file, but in the post_config phase
> you have an access to a complete configuration tree (via
> Apache2::Directive)."
> [1] http://perl.apache.org/docs/2.0/user/handlers/server.html
I couldn't get this to work for me; yes I could access the full
server config, but only as a massive hash where I would need to
iterate over the various VirtualHost names to find the bits I
wanted.. and that would mean hardcoding in the VirtualHost name. :)
I may simply have been misunderstanding it however.
In the meantime one of the devs at $dayjob suggested the following:
httpd.conf:
        <Virtualhost ...>
        ...
                <Perl>
                        use Foo::Bar;
                        Foo::Bar::loadConfig('/path/to/config');
                </Perl>
        ...
        </VirtualHost>
Foo/Bar.pm:
        package Foo::Bar;
        {       
                my $closure;
                sub loadConfigFrom {
                        $closure = WhateverYouParseConfigWith->new(-file => shift);
                }
                
                sub getConfig {
                        return $closure;
                }
        }
        1;
Then elsewhere in my code I can do:
        my $conf = Foo::Bar::getConfig;
safe in the knowledge that it is just shuffling memory around rather
than opening and parsing files with every hit..
Also I forgot that I would need:
        PerlOptions +Parent
in each vhost as otherwise each vhost is going to share the same
perl interpreter and thus symbol table.. that really confused me for
a bit!
Cheers,
Andy