User:Ans/flexible conf

flexible conf
When you write config file in perl, for example,
 * config.pl

What if you want to load this config from python, C, C++, php, java, etc.?
 * php code may look like,

passing external options to config file
In many cases, the flexible config file may accept some external options like,

To achieve this, php code will pass some runtime options, to config.pl like, and config.pl may use $opt like,

stdout approach

 * config.pl should generate output in xml?
 * load_flexible_config("perl", "config.pl") --> run the command "perl config.pl" and parse its xml output

libperl approach

 * 1) load_flexible_config("perl", "config.pl") --> use libperl to run or eval perl statement,
 * 2) convert internal perl data representation to php data

problem

 * There may be no library libphp, if you want to eval "config.php"?

other approaches

 * use .net framework
 * use DLR
 * use Lua
 * use parrot

note

 * Why not write config in XML or YAML or something like that? (To replace config.pl with config.xml)
 * Since XML/YAML can't execute the code. One goal of this flexible config is to be able to execute some code (in preferred script/language), some control statement ("if/else", for example). --Ans 06:09, 18 September 2008 (UTC)
 * This flexible config will not limit to write config.pl in just perl. It is designed to be able to load the config in other scripts, for example, config.php, config.py.