Syntactic Confectionery Delight | |
PerlMonks |
Re: Prioritizing command line optionsby grinder (Bishop) |
on Jan 19, 2002 at 02:55 UTC ( [id://139983]=note: print w/replies, xml ) | Need Help?? |
I know that Getopt::Mixed will let you do this, as it uses a serial approach to parsing the command line. On the other hand, a module such as Getopt::Long will not, as you can't intervene (Although I expect to be corrected if am I wrong on this point) in GetOptions, since there is no callback interface.
Getopt::Mixed turns the problem on its head, by the fact that you specify a template string for what arguments are to be recognised, and then you repeatedly call a function until it returns no more arguments. Consider:
In this way, the config file specified by --conf will be done at the point at which it is encountered on the command line. The only (minor) drawback is that this module is not bundled with the core distribution, you have to download it from CPAN. But it is a pure-perl module and so installs with a minimum of fuss. --g r i n d e r
|
|
---|
Log In? |
---|
Domain Nodelet? |
Node Status? |
node history Node Type: note [id://139983] help |
Chatterbox? |
How do I use this? • Last hour • Other CB clients |
Other Users? |
Others learning in the Monastery: (3) As of 2024-03-28 17:52 GMT |
Sections? |
Information? |
Find Nodes? |
Leftovers? |
|
Voting Booth? |
No recent polls found |