in reply to Combining Multiple Scripts and their Configuration Files into a Hierarchical Configuration

Quoting the AppConfig POD:

Multiple files may be passed to file() and should indicate the file name or be a reference to an open file handle or glob.

$config->file($filename, $filehandle, \*STDIN, ...);

[...]

room = /home/kitchen room /home/bedroom

Each subsequent re-definition of the variable value overwrites the previous value.

print $config->room(); # prints "/home/bedroom"
I suggest you use a --mastercfg or similar option in your subordinate scripts, which they will then read after their default configuration file so that AppConfig will override the variables first seen in the default configuration file with the values later seen in the master configuration file.

Makeshifts last the longest.

  • Comment on Re: Combining Multiple Scripts and their Configuration Files into a Hierarchical Configuration
  • Select or Download Code