in reply to Re: Reading and producing variable lists (w/o hashes!)
in thread Reading and producing variable lists (w/o hashes!)

I have a series of templates in a pseudocode style, used for config file generation for repeated and varying user setups. The pseudocode style has a pre-processor command style, e.g.
#define $var = "hello" #if($var = "hello") include this text in config file also include the word $var as an inserted word #endif
I have managed to get the evaluation of the #if statements sorted, but the actual definition of the variables is a bit more of a pain.

The reason for not using hashes is to avoid having to process each line of config text, looking for the $variable. Also, using the #if statements with hashes, I'd have to process the $variable and turn it into $list_of_variables->{$variable}.

Does that make sense? Do you agree? :-)

Replies are listed 'Best First'.
Re^3: Reading and producing variable lists (w/o hashes!)
by roboticus (Chancellor) on May 01, 2009 at 11:11 UTC
    bingohighway:

    Not to be difficult, but why not use cpp instead of reinventing the wheel? Or perhaps a templating engine (there's one or two on CPAN, I hear)?

    ...roboticus
Re^3: Reading and producing variable lists (w/o hashes!)
by wfsp (Abbot) on May 01, 2009 at 11:25 UTC
    I agree with roboticus about the templates and would add that there are one or two config modules that are more than happy to generate files too.

    So, imho, it would be wise to at least have a look at the prior art.