I had similar question, so I re-invented the wheel and wrote my own GetOpts wrapper

app code library code tests more tests

(you can use it if you want to and capable to understand how it works, it's GPLv3. or maybe some day i'll release it on CPAN with product quality and documentation)

Basically I verify options and option combination using plain 'if/else' code, but in separate 'layer' (before program execution), so when program start main work it has already all options validated and possibly reorganized.

And I have DSL to for easier validation layer implementation for easier options definitions

Also the library manages error/warning messages and helps to write unit test for options behaviour with ease

Also you can try to reorganize your command line API and discinct options, commands, positional parameters, and script name aliases. That way complex options will look more sane

Example:

myapp-recaulculate.pl full-recalculate myfile --fast --ignore-errors
instead of
myapp.pl --reculculate --use-full-recalculate --file myfile --fast --i +gnore-errors.
Also, I believe there is more than 100 CPAN modules, related to options processing. You can try to find one that fits your need.

In reply to Re: Getopt::Long via. Hashes by vsespb
in thread Getopt::Long via. Hashes by librarat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.