The stupid question is the question not asked | |
PerlMonks |
Specifying multiple conditions in a config fileby korpenkraxar (Sexton) |
on Jan 24, 2012 at 21:50 UTC ( [id://949775]=perlquestion: print w/replies, xml ) | Need Help?? |
korpenkraxar has asked for the wisdom of the Perl Monks concerning the following question: Dear bringers of Perl wisdom, I am designing a Perl program that uses external configuration files and I thought I better ask here before I fall down the rabbit hole. In the application, the user will be able to specify certain external actions or settings (values in the config file) that are tied to labeled conditions in my program (keys in the config file). The program parses the settings and notes what actions are tied to what condition. This is pretty straightforward if the conditions are all expected to be "true" and "singular", but what if I would like to provide the option to trigger actions when a condition is not true or be able to combine conditions into arbitrary nested sets? I guess my question boils down to this, should I spend time trying to develop a condition engine that can take any specified nested set of true or false conditions and walk through the corresponding Perl "if", "else", "OR", "AND" , "NOT" , "()" chain or simply require the user to write his/her own modified object that has requirements different from the basic vanilla object? The first option may be nice for the user if the grammar is close to what we are used to from search engines for instance. However, unless there already exists a module that generates such conditional Perl code on the fly, I suspect I will be spending most of my development time on that feature alone. The second option is far more simple to implement, but basically asks users to write their own plugins. What are your thoughts on this?
Back to
Seekers of Perl Wisdom
|
|