Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Reading and producing variable lists (w/o hashes!)

by bingohighway (Acolyte)
on May 01, 2009 at 10:49 UTC ( [id://761255]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://761255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2024-04-23 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found