Chinaunix

标题: 为什么在waitfor时候出现pattern match read eof at test_telnet.pl line 63 [打印本页]

作者: Aaron.Gao    时间: 2006-01-17 08:59
标题: 为什么在waitfor时候出现pattern match read eof at test_telnet.pl line 63

  1. my $telnet_hdl=new Net::Telnet (Timeout => 1800, Prompt => '/[\$%#>:]\s*$/');
  2. $telnet_hdl->open(Host=>$ip,Timeout=>60);
  3. $telnet_hdl->login($user, $password);
  4. ...
  5. ...some operate
  6. ...
  7. $telnet_hdl->print("exit");
  8. ($cmd_result_msg1,$match1)=$telnet_hdl->waitfor(Match=>'/Connection closed by foreign host./',Timeout=>60);
  9. print "$cmd_result_msg1";
  10. print "$match1\n";
  11. $telnet_hdl->close;
复制代码

为什么在waitfor时候出现pattern match read eof at test_telnet.pl line 63
我查了Telnet.pm的waitfor,呵呵 实在是没看懂,谁能帮我解释一下
  1. return $self->error("pattern match read eof") if $s->{eofile};
复制代码

返回的pattern match read eof 具体是什么意思,非常感谢
作者: Aaron.Gao    时间: 2006-01-17 09:20
不好意思,我错了
好象直接$telnet_hdl->close;
就可以,不用多余exit

晕啊




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2