Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Net::Telnet disappearing data :)

by PrakashK (Pilgrim)
on Jul 24, 2001 at 00:34 UTC ( #99160=note: print w/ replies, xml ) Need Help??


in reply to Net::Telnet disappearing data :)

When you check for end of file, you are not using the object method ($connect->eof). Instead, the perl builtin eof is being used. Although, it might be working in your case ("eof" without an argument uses the last file read), it would be more correct and safer to use the object method.

...the second snippet of code fixes it...but i don't know how to break the loop looking for eof or timeout...

You can use the timed_out method to test for timeout.

my $lineid = 0; while ($lineid < 20) { my $linedata = $connect->getline; # check for eof or time-out _before_ using the data last if $connect->eof or $connect->timed_out; # now save the line push(@data,$linedata); $lineid++; }


Comment on Re: Net::Telnet disappearing data :)
Select or Download Code
Re: Re: Net::Telnet disappearing data :)
by DesolateCoder (Initiate) on Jul 24, 2001 at 01:34 UTC
    Thank-you much....this works :) Also a problem with original method is my Prompt=> /regex/ was hosed....so maybe i can use the array up front...have to play.
    my $experience = "nonexistent"; my $thoughts = "worthless"; unless ($experience) { print "You're $thoughts\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://99160]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2014-07-24 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls