wro has asked for the wisdom of the Perl Monks concerning the following question:
Basically i don't want to make several outputs for the displaying of the commands of a switch we have, for now for every "press a key" I need to attach a new array to the older one, is there any way around this? I found out if I try a prompt and do the things manually it also asks a keypress for the next page, but not if i make the prompt screen larger. Perhaps there's a way to incorperate this in the telnet command or something? Also i want do an action if i get an error from the telnet command, the above code doesn't work if i do a $fault is not empty it still skips it, even when i print $fault it says: 'pattern match timed-out' (as it should be) however, i never get to the code with the check if $fault is empty Any suggestions? As i am new to the perl language they will be highly noted. Thanks in advance#start input of commands in telnet #---------------------------------- $telnet->waitfor('/\# $/i'); $telnet->print($cmd); @output=$telnet->waitfor('/Press any key to continue \(Q to quit\)/'); + $telnet->print('c'); #virtually press c key @output2=$telnet->waitfor('/\# $/i'); push(@output,@output2); $telnet->waitfor('/dfs=l,gdmgll<>ifdgoij$/i'); #creates a deliberate e +rror for error logging $fault=$telnet->errmsg; $telnet->close; if ($fault!="") { print "you got an error; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: telnet with keypress and errmsg problem
by jakobi (Pilgrim) on Sep 30, 2009 at 15:53 UTC | |
by wro (Initiate) on Oct 01, 2009 at 09:35 UTC | |
by jakobi (Pilgrim) on Oct 01, 2009 at 16:39 UTC | |
|
Re: telnet with keypress and errmsg problem
by jakobi (Pilgrim) on Oct 01, 2009 at 14:56 UTC |