Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi,

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:

  1. Read an ini file (Config::IniFile).
  2. Start up a number of processes defined in it (Win32::Process)
  3. Check that the process don't go away over time (Win32::Process)
  4. When the time comes (i.e. the service is cancelled) shut the processes down again (Win32::Process).

The ini looks like this:

[GENERAL] scheduledb=e:\users\dbush\schedule.db [SERVICE] debug=1 interval=5 start1=browser.exe;browser;NORMAL_PRIORITY_CLASS start2=schedule.exe;schedule "localhost:%general-scheduledb%";NORMAL_P +RIORITY_CLASS

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.

Regards,
Dom.


In reply to Substituting tokens into configuration values by dbush

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-03-28 15:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found