开发者

Perl GetOptions() case sensitivity

GetOptions(
    "r|repo=s"       =>  开发者_JAVA技巧 \$repo,
    "R|list-repos"   =>   \$list,
);

When I call this script with -r qwe option, $list is updated to 1, which is not what I expect.

How can I make GetOpt case sensitive?


use Getopt::Long qw(:config no_ignore_case);


Also enabling bundling fixes it too:

use Getopt::Long  qw(:config bundling);

From the documentation:

When configured for bundling, single-character options are matched case sensitive while long options are matched case insensitive. To have the single-character options matched case insensitive as well, use:

Getopt::Long::Configure ("bundling", "ignorecase_always");

And the author adds :

It goes without saying that bundling can be quite confusing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜