http://www.perlmonks.org?node_id=540581


in reply to telnet waitfor problem

Just out of idle curiousity, what happens when you perform the steps manually - in other words open your own telnet session to the target server, manually type in the commands you think you're sending via your perl script - do you see the telnet session return text matching "0 Successful"? (Apologies if I'm missing something, as I'm not familiar with Net::Telnet)

Update: I found out I have Net::Telnet installed on my local system, so a quick perusal of the docs shows:

Debugging The typical usage bug causes a time-out error because you've ma +de incorrect assumptions about what the remote side actually sends +. The easiest way to reconcile what the remote side sends with your e +xpecta- tions is to use "input_log()" or "dump_log()". "dump_log()" allows you to see the data being sent from the rem +ote side before any translation is done, while "input_log()" shows you t +he results after translation. The translation includes converting + end of line characters, removing and responding to TELNET protocol com +mands in the data stream.

Maybe $telnet->dump_log() will help you out.



--chargrill
$,=42;for(34,0,-3,9,-11,11,-17,7,-5){$*.=pack'c'=>$,+=$_}for(reverse s +plit//=>$* ){$%++?$ %%2?push@C,$_,$":push@c,$_,$":(push@C,$_,$")&&push@c,$"}$C[$# +C]=$/;($#C >$#c)?($ c=\@C)&&($ C=\@c):($ c=\@c)&&($C=\@C);$%=$|;for(@$c){print$_^ +$$C[$%++]}

Replies are listed 'Best First'.
Re^2: telnet waitfor problem
by ultibuzz (Monk) on Apr 01, 2006 at 00:19 UTC
    0 Succsessfull means the command wents trough and its processed right any other return is a failure for exp 1999 Succesfull or because its an crapy damn old laggy total ... machin it just spit out some prov bla foobar text when i do it manuall mostly 0 Successful apears but somtimes 1999 or somthing else so the script basicly is working just the errormode is wrong as i get in the chatbox ;D default is DIE
    update
    my $telnet = Net::Telnet->new(Timeout => 30,Errmode => 'return'); solves the problem but thx to all of you for help