Re: Best approach to store Application Configuration

"McCarrell, Jeff" <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CA40BED4.342E%[email protected]>
Naming the path to the config file in an httpd conf will certainly work.
In my case, the path the config file is hard coded in the method that reads the config as it is not something that changes.

Here is on of my httpd conf file (a separate file loaded in the http configuration directory so your install process doesn't have to change the actual httpd.conf):
PerlModule    Your::App
PerlPostConfigHandler Your::App::httpd_start

<Location /foo/app>
    SetHandler modperl
    PerlResponseHandler   +Your::App

    # Apache::DBI needs GlobalRequest
    PerlOptions +GlobalRequest
</Location>

The httpd_start method gets called at apache startup time, and reads the config in once.

Also, one other possible advantage to YAML is that YAML is not perl, so if you have a mixed language env,
it is easy to share/move/port your config to the language of your choice.
YAML has pretty good support across the common languages you will find in the LAMP world.

BTW, if you haven't already done so, I recommend becoming familiar with the handlers and their life cycles:
http://perl.apache.org/docs/2.0/user/handlers/server.html
http://perl.apache.org/docs/2.0/user/handlers/http.html#HTTP_Request_Cycle_Phases

Have fun,

-- jeff

From: Jerry Pereira <[email protected]<mailto:[email protected]>>
Date: Mon, 11 Jul 2011 16:41:13 -0500
To: Jeff McCarrell <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Subject: Re: Best approach to store Application Configuration

please correct me if I am wrong, I should be using tool like YAML/Config::General for application configuration storage and reteieval, and load them on startup using startup.pl<http://startup.pl> script? That would mean i will have to store the name of configuration file some where (probabaly in mod_perl configuration block in httpd.conf).
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.