Perl的Getopt :: Long解析参数我没有提前定义吗?

前端之家收集整理的这篇文章主要介绍了Perl的Getopt :: Long解析参数我没有提前定义吗?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道如何使用Perl的Getopt :: Long,但我不知道如何配置它来接受任何未明确定义的“–key = value”对并将其粘贴在哈希中.换句话说,我不知道用户可能想要什么选项,所以我无法定义所有选项,但我希望能够解析所有这些选项.

建议?提前谢谢.

@H_403_12@解决方法
Getopt::Long文档提供了一个可能有用的配置选项:

pass_through (default: disabled)
             Options that are unknown,ambiguous or supplied
             with an invalid option value are passed through
             in @ARGV instead of being flagged as errors.
             This makes it possible to write wrapper scripts
             that process only part of the user supplied
             command line arguments,and pass the remaining
             options to some other program.

解析常规选项后,您可以使用诸如provided by runrig之类的代码来解析临时选项.

猜你在找的Perl相关文章