I use Config::Simple to get some values out of a text file, but other values (like whether a user has authenticated, what their ID is, etc.) have to come from the user. I was thinking of wrapping everything in a Module, but I'm not sure the best way to do it. Ideally, the solution would be upwardly mobile to mod_perl so that I wouldn't have to do any more research to figure out how to port it to mod_perl. I've been thinking that perhaps a do <filename> would work, but I'm concerned about namespace issues, and I'm not sure if I would get new values with a do and mod_perl. (I've not yet started the process of porting to mod_perl, so this requirement is a phantom at the moment... not really important, just a wish).
Here is a sample of the configuration code at the top of one file. Ideally this kind of stuff would go somewhere central and be pulled by all scripts in the suite:
my @chars = ('A'..'Z','a'..'z',0..9);
my $config = Config::Simple->new("../etc/annie.conf");
my $dbh = &widgets::dbConnect($config);
my $authInfo = &auth::authenticated($dbh);
my $scriptdir = $config->param("server.scriptdirectory");
my $serverURL = $config->param("server.url");
my $docURL = $config->param("server.documenturl");
my $action = $http::C->param("action") || "";
my $docDir = $config->param("server.documentdirectory");
my $ID = $http::C->param("ID");
my $template = Template->new( RELATIVE => 1,
INCLUDE_PATH => "../templates");
|