Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl Net::Telnet,发送是或否_Perl - Fatal编程技术网

Perl 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-

我正在编写一个使用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-fireworks');
$telnet->waitfor('Are you sure? (yes/no/MAYBE)');
$telnet->cmd('yes');

yes
之后,我们希望提示符出现,因此我们可以再次使用
cmd()

看起来像是您将
prompt
参数指定给
cmd
,当它返回时,您使用
$tel->cmd('yes')