perlquestion
shail
<p>In one of scripts, wanted to add facilty to set options via configfile alongside getting it from cmdline. </p>
I looked at bunch of different ways to set options using configfile and cmdline.
<ol>
<li> simple perl file read for configfile and use of getOpt::Long for cmdline options</li>
<li> AppConfig for both configfile and cmdline args</li>
<li> configReader:: Did not dwell much into it</li>
</ol>
I am leaning towards 1) since it is simple and does what I want.
<p>Now main question: </p>
<p>one thing that I did not like in all of them was the fact that you had to deal with same varible three times.
<ol>
<li>first, you declare the variable</li>
<li>then, you pass it as Hash to the function that reads it ..</li>
<li>then, again deal with same variable in the usage()...</li>
</ol>
</p>
<p>Is there a way I have to deal with the variable just once?? </p>
I took a brief look at GetOpt::Declare() and It seems that helps reduce the dealings to twice ...But then it is not as powerful as AppConfg and does not allow reading files...
<p> Any smart way to reduce dealing with variables ? </p>
<p> Thoughts on ways to read arguments via configfile also welcome/appreciated. </p>