如何在perl cgi上使用stdin

eli*_*128 0 perl cgi

我是perl的新手,我想在我的脚本上使用屏幕输入.这是我的脚本,我希望从键盘输入IOS命令.可以有人告诉我我错在哪里.问题我现在的脚本没有读取我的键盘输入,我不确定是否可以处理我的情况.谢谢!!

# ### Show ######################################################### 
               $cmd = <STDIN>;
                chomp ($cmd);
               $show_error = "";
              if ($ssh_switch eq 'yes') {
                   ssh_access();
               }
               print "\n",h2($host . ' - ' . $cmd);
                @output=$cmd;
                print hr(),"\n";
               }
}
#########################################################################
Run Code Online (Sandbox Code Playgroud)

Que*_*tin 5

CGI旨在接收完整的HTTP请求,然后吐出完整的HTTP响应.

它根本不能以交互方式工作.

如果要编写需要键盘输入的脚本,请不要使用CGI.

  • 是的,但不是互动的. (2认同)