develooper Front page | perl.beginners | Postings from March 2002

Re: net::telnet and read eof error

Thread Previous
March 13, 2002 22:55
Re: net::telnet and read eof error
Message ID:
On Wednesday 13 March 2002 10:30 am, Craig Williams wrote:
> In my first attempt at telneting into sun box from win98, i've been
> receiving the error message : pattern match read eof at line
> xx    ------   where xx is the login line. Unable to resolve that error
> through the usual methods I tried executing the rainmaker sample in the
> documentation at the end of the net::telnet module and received the same
> error (this time at the "$t->waitfor('/continue:*$/);) line. I'm guessing
> it's a setup error on my machine but haven't a clue where to look.  Any
> ideas?
> (sample from the net::telnet documentation that i ran)
> #!perl -w
>     my ($forecast, $t);
>     use Net::Telnet ();
>     $t = new Net::Telnet;
>     $t->open("");
>     ## Wait for first prompt and "hit return".
>     $t->waitfor('/continue:.*$/');
>     $t->print("");
>     ## Wait for second prompt and respond with city code.
>     $t->waitfor('/city code.*$/');
>     $t->print("BRD");
>     ## Read and print the first page of forecast.
>     ($forecast) = $t->waitfor('/[ \t]+press return to continue/i');
>     print $forecast;
>     exit;

This may be a telnet client issue and not a perl problem. You might look at 
changing your Win98 telnet client to send a line feed instead of a carriage 
return. I'm not sure how to do this in win98 (also depends on the telnet 

From my *BSD box I was able to run your provided sample code without a 
problem. Also, if you manually telnet to, you'll 
notice the following in the welcome message:

   **Note: If you cannot get past this opening screen, you must configure
   *   your telnet program to send a line feed instead of just a carriage
   *   return, or use a different telnet program that does so.

Hope this helps. 

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About