これは私が、コマンドライン引数の取り扱いをテストするために書かれている簡単なスクリプトです:PerlのGetOpt :: Longは、略語を受け入れてバグに切り替えるのですか?
use Getopt::Long;
my $help = 0;
GetOptions(
'help|h|?' => \$help,
) or die "Error!";
print "OK\n";
私が得た結果は次のとおりです。
D:\>perl test.pl --help
OK
D:\>perl test.pl --hell
Unknown option: hell
Error! at test.pl line 10.
D:\>perl test.pl --he
OK
D:\>perl test.pl --hel
OK
は、誰もがこの前に気づいていますか?行動(彼と助けの代わりにヘルを受け入れる)は潜在的なバグですか?
ありがとうございます。 – Andy