in reply to Re^4: Net::Telnet: how to detect an empty line...
in thread Net::Telnet: how to detect an empty line...
Like pc88mxer already said, you need to know when to stop to read. Your code
@resp = <$s>; # expect one line response
will read from $s until your daemon stops or closes the socket, contrary to your comment that it will only read one line. Try it with the following code:
@resp = (); while (defined $_ = <$s> and ! /^\s*$/) { warn "DEBUG: Got >$_<"; push @resp, $_; };
The above loop will output some debug information and read until the next empty line. If something goes wrong, you will easily see that from the debug information ...
|
|---|