sans-clue has asked for the wisdom of the Perl Monks concerning the following question:

I am using the Telnet PM to print out a stream from a device and it works fine.
use Net::Telnet; my $t = Net::Telnet->new( Time => 99999999, Port => 23 ); $t->open(1.2.3.4); while (my $output = $t->getline()) { print $output; }
but I found I need to print/type something out every 60 seconds $t->print('HELLO'); Since this while loop waits for output, it can be idle for a long time so I can't issue the 'HELLO' on a timely basis. Any ideas how I could do this ? I can't timeout and reconnect, because it will cause the device grief. I need to wait for input yet issue 'HELLO' every 60 secs... thanks

Replies are listed 'Best First'.
Re: While loop - telnet module question
by gmargo (Hermit) on Nov 04, 2009 at 22:52 UTC

    Take a look at the documentation for Net::Telnet: getline() takes a Timeout parameter.