是否有用于空头期权处理的 %*SUB-MAIN-OPTS 对?

Is there a %*SUB-MAIN-OPTS pair for short option processing?

Perl6 中的multi sub MAIN() 命令行解析很不错!

据我从 Command Line Interface 文档中得知,动态哈希 %*SUB-MAIN-OPTS 中仅支持一个选项来操纵选项处理(即 :named-anywhere) .

也许我错过了显而易见的东西,但是是否有一个 existing/supported 选项来选择 'old fashioned' 单破折号选项?

例如:

#Instead of this...
myprogram.p6 --alpha=value1 --beta==value2 --chi

#... short options like this
myprogram.p6 -a value1 -bvalue2 -c

或者这最好是手动处理还是使用外部模块?

你可以模仿这个 as-is,尽管你仍然需要一个 = ala -a=foo,并且在技术上除了 --alpha-a

sub MAIN(:a(:$alpha)!) {
    say $alpha;
}

...所以您可能想使用 https://github.com/Leont/getopt-long6

use Getopt::Long;
get-options("alpha=a" => my $alpha);