in reply to Re: how to deal with 20 commands
in thread how to deal with 20 commands

thanks for all the help.
what i am looking for is some thing which works the same way as the module GetOpt::Long or STD works. they parse the command line swtiches and the programmer doesnt habe to worry about if the switches have been types correctly or not
so is there some thing which can do the same for commands too?

Replies are listed 'Best First'.
Re^3: how to deal with 20 commands
by Zaxo (Archbishop) on May 23, 2005 at 02:54 UTC

    You could use Getopt::Long:

    local @ARGV = @_; GetOptions( # . . . ) or warn 'Whatever';

    After Compline,
    Zaxo

      It's a pet peeve of mine that Getopt::Long doesn't accept input from anything but @ARGV. I really hope this changes in Perl6 (and no, not just so that it expects input only from @*ARGS ;-)
        Are there getopt libraries for other languages that take input from places other than the command line? I realize that taking values from the environment or from an rc file might be useful, but I would argue against putting that in the getopt library but rather have applications handle it on a case by case basis.

        thor

        Feel the white light, the light within
        Be your own disciple, fan the sparks of will
        For all of us waiting, your kingdom will come

Re^3: how to deal with 20 commands
by ivancho (Hermit) on May 23, 2005 at 05:06 UTC
    You can, of course, do something crazy, and search for 'shell', or 'interactive' on CPAN - maybe someone's been through this before.. it may also reduce the probability that one day one of your users will type
    innocent 'not_really; rm -rf ~/*'
    and walk away whistling...

    seriously, though, read more; ask only when you can show you've put some effort into it...