Perl Net::Telnet,发送是或否
我正在编写一个使用Net::Telnet的程序,但是当我使用Perl Net::Telnet,发送是或否,perl,Perl,我正在编写一个使用Net::Telnet的程序,但是当我使用$tel->cmd时,设备会等待是或否继续cmd,我如何使用Net::Telnet 如果您不希望出现提示,请使用print()和waitfor()而不是cmd() 例如,对话: testmachine# launch-fireworks Are you sure? (yes/no/MAYBE) yes Fireworks launched testmachine# 可以自动化,如: $telnet->print('launch-
$tel->cmd
时,设备会等待是或否继续cmd,我如何使用Net::Telnet 如果您不希望出现提示,请使用print()
和waitfor()
而不是cmd()
例如,对话:
testmachine# launch-fireworks
Are you sure? (yes/no/MAYBE) yes
Fireworks launched
testmachine#
可以自动化,如:
$telnet->print('launch-fireworks');
$telnet->waitfor('Are you sure? (yes/no/MAYBE)');
$telnet->cmd('yes');
在
yes
之后,我们希望提示符出现,因此我们可以再次使用cmd()
。看起来像是您将prompt
参数指定给cmd
,当它返回时,您使用$tel->cmd('yes')代码>。