shail has asked for the wisdom of the Perl Monks concerning the following question:
In one of scripts, wanted to add facilty to set options via configfile alongside getting it from cmdline.
I looked at bunch of different ways to set options using configfile and cmdline.- simple perl file read for configfile and use of getOpt::Long for cmdline options
- AppConfig for both configfile and cmdline args
- configReader:: Did not dwell much into it
Now main question:
one thing that I did not like in all of them was the fact that you had to deal with same varible three times.
- first, you declare the variable
- then, you pass it as Hash to the function that reads it ..
- then, again deal with same variable in the usage()...
Is there a way I have to deal with the variable just once??
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...Any smart way to reduce dealing with variables ?
Thoughts on ways to read arguments via configfile also welcome/appreciated.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Smart way to deal with cmdline Args?
by chrestomanci (Priest) on Dec 07, 2010 at 22:27 UTC | |
Re: Smart way to deal with cmdline Args?
by Anonymous Monk on Dec 07, 2010 at 22:24 UTC | |
by shail (Initiate) on Dec 08, 2010 at 17:29 UTC | |
Re: Smart way to deal with cmdline Args?
by kevbot (Vicar) on Dec 10, 2010 at 08:52 UTC |
Back to
Seekers of Perl Wisdom