Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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++; }

Replies are listed 'Best First'.
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 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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://99160]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-12-14 19:14 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (406 votes). Check out past polls.