in reply to What is easiest config file parser?

See Config::Simple

hth,

PooLpi


'Ebry haffa hoe hab im tik a bush'. Jamaican proverb
  • Comment on Re: What is easiest config file parser?

Replies are listed 'Best First'.
Re^2: What is easiest config file parser?
by Anonymous Monk on Mar 22, 2008 at 09:03 UTC
    Thank you for all the suggestions, I did wind up using Config::Simple, the only thing I'm not understanding is why it won't accept a relative path to the file. I am opening like this:
    if ($cfgpath) { use Config::Simple ('-lc'); my $cfg = new Config::Simple($cfgpath) or die "Could not find configuration file $cfgpath\n"; .....
    The problem is that if $cfgpath contains anything other than a full path and filename it doesn't work. If I just specify the config filename alone it doesn't find it, even if it's in the same directory as the script (which I can sort of understand, it's probably looking at some other directory) BUT it also won't work if I specify something like ~/temp/myconfig.cfg, even though the file exists. If I specify the full path then it works. Not a huge deal, I guess, but I wish I understood why that won't work.
      If you run the program in the directory it lives, then the program should be able to find the configuration file by relative path. Otherwise, there is no surprise that configuration file cannot be found; you may want to look in FindBin.