小编Dha*_*i P的帖子

Negatable options in perl

I have a negatable option defined as top!.

When a command uses this option, say : command_name -top, prints a warning to the user

Code snippet for it is as follows :

if ($args{top}) { print "Warning"; }
Run Code Online (Sandbox Code Playgroud)

但是,当命令使用否定选项时,例如:command_name -notop,它不会向用户打印相同的警告。

有没有办法在这两种情况下获得相同的警告?

perl options getopt getopt-long command-line-arguments

1
推荐指数
1
解决办法
77
查看次数