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....
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|