Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Parsing commandline with subcommands

by vsespb (Hermit)
on Jul 18, 2013 at 12:12 UTC ( #1045081=note: print w/ replies, xml ) Need Help??


in reply to Parsing commandline with subcommands

1. pass all possible options for command and subcommands to Getopt::Long (passing all ever possible options is also necessary for consistency as options are auto-abbreviated)

2. After Getopt::Long processing @ARGV will contain non-options. Extract commands and subcommands from it

3. Analyze your options like

if delete $opts{myoption} ...

4. After analyze if you still have something unrecognized in @ARGV or %opts - that is unused options an you need to throw an error


Comment on Re: Parsing commandline with subcommands
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2015-07-08 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls