in reply to (tye)Re: timed_out usage?
in thread timed_out usage?
use Net::Telnet (); <--some variables defined here--> $connect = new Net::Telnet (Telnetmode => 1); $connect->open(Host => $hostname, Port => $port); # For debugging print "First, login with $act\n"; print "\n"; <---snip---> print "Now for the RTRV command:\n"; print "command is $rtrv\n"; print "\n"; $connect->print("$rtrv"); (@prematch,$match) = $connect->waitfor('/COMPLD/'); while (@rlines = $connect->getlines(Timeout =>1)) { print @rlines; }
So, you see it uses the perl telnet.pm module. Pretty simple really, but the problem I'm having is that the data stream doesn't flow consistently, and getlines apparently believes it is finished taking data before all the data is actually retrieved. So, I repeatedly call getlines until finally one of the requests gets a blank line. At this point it times out. My problem is that I want to issue one more command after I've received all the data (I need to log out gracefully). But, when the timeout occurs, the script exits. I can't do anything further. There does appear to be a way to check the status of timed_out, which is what I need (I think). If I time out, then log out, don't just exit. Another solution may be to change the Errmode from the default of "die" to something else.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: (tye)Re: timed_out usage?
by Galen (Beadle) on Mar 23, 2001 at 00:23 UTC |