Hi everyone, i am almost ready with the MSN perl module that i was talking here
a few days ago, but since it is my first program with sockets, i have a little
problem, this subroutine gets the server answers of my request, usually the server
answer with just one line, and this sub works just fine, but if i modify it to get
more than one lines it don't do anything :(
The modifications that i've tried are:
change
my $line = <$sock>;
to
my @lines = <$sock>;
And it didn't work , and the other was
while ( my $line = <$sock> ) { #more stuff }
With any of the 2 changes it doesn't work
Any help.
Thanx all
sub sendCommands{
if (@_) {
print $sock "$_[0]\r\n"; #$sock is a socket to the server
my $line = <$sock>;
print "Client: $_[0]\r\nServer: $line" if $DEBUG;
my @values = split(/ /,$line);
return @values if ( $line )
}
}
Dreams they just disapear into the shadows,
then they become true....
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.