Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Getting multiline input from a serverby HyperZonk (Friar) |
on Jul 26, 2001 at 07:48 UTC ( [id://99886]=note: print w/replies, xml ) | Need Help?? |
If I'm not mistaken, it's because of your loop structure.
Say that @from_server does indeed suck up all of the data
from the socket (I am not convinced that it does, the suggested
idiom is to loop across while defined($input = <$socket>)),
then you get the number of lines slurped back as the scalar
value of the assignment. It then loops and attempts to read
from the socket again. Presumably, there is no more data on
the socket, so it sits there and waits for data. If assigning socket IO to an array works, and I would recommend using the suggested idiom instead, but if, you would want: Note that there is no loop. Update: As tilly noted, I am sure that it is your loop structure; what I'm not sure of is if it is hanging on the first pass because "you can't do that with sockets" or if it is because, "you can do that," but it is hanging on the second pass through the loop. -HZ
In Section
Seekers of Perl Wisdom
|
|