We don't bite newbies here... much | |
PerlMonks |
Command line optionsby rpelak (Sexton) |
on Nov 01, 2011 at 19:48 UTC ( [id://935197]=perlquestion: print w/replies, xml ) | Need Help?? |
rpelak has asked for the wisdom of the Perl Monks concerning the following question:
So I have run into a situation several times, that the standard modules don't seem to support. And that makes me think maybe I am doing it wrong... So I wanted to come here and ask... :)
I write scripts... in various languages... perl and tcl to name the major ones.
I often find myself wishing I could check if that value of an option post-parsing came from the user providing it on the command line, or was just the default.
here is one such general case. So basically the order of preference is, user given, derived, default. Most parsers will handle user given, and default, but don't provide a good way to know which was used for any specific option. I can (and have on occasion) written my own command line parser, but such a simple thing as if an option was actually on the command line seems like it would be in the normal parsers, yet I don't see it, making me think it isn't normal to need it. And thus I might be off, or my need it just uncommon. thoughts?
Back to
Seekers of Perl Wisdom
|
|