in reply to Enforce single hyphen for single character options in Getopt::Long

Could you rephrase and/or explain more the "latter isn't processed" part ...
I had hoped qw( :config prefix_pattern - long_prefix_pattern -- ) would get me what I want, but it seems like the latter isn't processed if the former doesn't match.
... ?
  • Comment on Re: Enforce single hyphen for single character options in Getopt::Long

Replies are listed 'Best First'.
Re^2: Enforce single hyphen for single character options in Getopt::Long
by mrnoname1000 (Sexton) on Feb 25, 2024 at 00:34 UTC

    Sure, it seems like arguments are checked against prefix_pattern to determine whether they're an option, and only after that succeeds are they additionally checked against long_prefix_pattern. I was hoping the two patterns would be checked separately so I could get mutually exclusive short/long option prefixes.

    In essence, I just want to disallow the use of --c in this example. This may not be possible without some unholy hacks, but I'm open to experimenting!