Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Getopt::Long via. Hashes

by Jim (Curate)
on May 27, 2013 at 02:00 UTC ( #1035346=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Getopt::Long via. Hashes
in thread Getopt::Long via. Hashes

Also some application prefer to allow any option to be used in config or in command line

Are there any fine exemplars of exactly this kind of Perl program on PerlMonks? I've been looking for a well-written Perl program that demonstrates the best way to use either a core module or a battle-tested CPAN module to permit the user to specify many arguments to the program either on the command line or in a config file—whichever she prefers.

Jim


Comment on Re^3: Getopt::Long via. Hashes
Re^4: Getopt::Long via. Hashes
by vsespb (Hermit) on May 27, 2013 at 07:11 UTC
    Are there any fine exemplars of exactly this kind of Perl program on PerlMonks?
    No, I am not aware of
    either a core module or a battle-tested CPAN module to permit
    to the program either on the command line or in a config file
    No, my program above permits it, but use custom libraries.

    I think you actually can write such code by yourself. It's easy to parse config and use it as default source, when a command line option is missing. And for command line you can use GetOpts. Looks like it can fit to 20 lines of code.

    However if you want error handling, multiple encodings support, complex config file(s) structure, unit tests for this, etc, it can require times more coding.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-09-30 20:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (383 votes), past polls