|Pathologically Eclectic Rubbish Lister|
Substituting tokens into configuration valuesby dbush (Deacon)
|on Mar 20, 2003 at 13:18 UTC||Need Help??|
dbush has asked for the wisdom of the Perl Monks concerning the following question:
I appear to be suffering from brain fade today and so I'm having a bit of difficulty starting what I feel should be a simple problem. I wonder if anyone with a working brain can help?
Background: I am trying to write a Win32 service using PerlSvc from ActiveState to achieve something like this SOAP in an NT Service but as I can't predict what I will be running with it later, I wish to have the service driven by a configuration file.
Problem: I wish to enhance my configuration file with "tokens" that refer to other sections of the ini file.
This service has only the following purposes in life:
The ini looks like this:
The format of the start lines is appname;cmdline;priority.
I have the basics of this, reading the .ini, starting the processes, monitoring then and then shutting them, working well and am happy about this. The problem comes that I wish to extend the command line section to include "tokens" e.g. %general-schedule% that can be parsed to include other configuration items e.g. e:\users\dbush\schedule.db.
After briefly contemplating using one of the templating modules (node Best templating system? and various others) I'm wondering if this is a bit of a sledgehammer approach? Would a better approach be to extract the tokens, retrieve the values and then substitute them back in? I had a Super Search but with little success.
Any help appreciated.