Hi Monks,
I am writing a script using the AppConfig module to load from values from a flat config file. I want comment out a value in the Config file and not have AppConfig throw an error. here is a example
CODE:
#!/usr/bin/perl
use strict;
use AppConfig qw(:expand :argcount);
#Create $config object
my $config = AppConfig->new({
GLOBAL =>
{
ARGCOUNT => ARGCOUNT_ONE,
DEFAULT => "",
},
CREATE => 1,
});
#open config file
unless ($config->file("config.conf"))
{
die "Could not open or find configuration file.\n";
}
my $user_name = $config->get("global_username");
my $password = $config->get("global_password");
With the following config file,
config.conf:
[GLOBAL]
#Set you username
username = default
#Do not uncomment unless you need to
#password = default
If if do it this way currently, AppConfig throws an error:
" global_password: no such variable"
What can I do to fix this?
edited: Thu Jun 12 12:09:00 2003
by jeffa - title change (was: AppConfig)