Hi All,
 
I've been trying to write the module to control my Cbus lighting system. The control is pretty easy, just open a socket to the Cbus server, send a command and wait for a response. 
 
But I've hit a little snag with the 'waiting for a response' bit. To get the status of a light I'm using a bit of code like;
 
    $cmd_port->set( $cmd_line );
    while( ! ($data = $cmd_port->said) )
    {
    }
 
This caused MisterHouse to lock up because I stoped the main loopy bit from executing.
 
Is there anyway of nicely handling this sort of thing?
 
I don't want to return execution to the calling routine before the response with the status arrives on the socket, after all that is what the calling routine wanted made the call for.
 
The only way I can see around this is to call the 'check_for_socket_data' inside my while loop, which doesn't seem a very nice method of solving the problem.
 
 
Thanks,
Nick Maddock