sub execute { my $port = 1200; my $sock = new IO::Socket::INET ( PeerAddr => $host, PeerPort => $port, Proto => 'tcp' ); die "Couldn't connect to $host:$port : $@" unless ($sock); # Saints preserve me from having to use this # my $flags; # fcntl($sock, F_GETFL, $flags) or die "Couldn't get flags for socket: $!"; # $flags |= O_NONBLOCK; # fcntl($sock, F_SETFL, $flags) or die "Couldn't set flags for socket: $!"; my_header('Processing Command', 'wheat'); printf "Site %s is on %s
", param('site'), $host; my @args; foreach my $i ( @{ $action{$selection}{args} } ) { push @args, param($i); } my @command = join(' ', ($action{$selection}{command}, @args)); my ($line, @output); print "Waiting for ready signal . . .
";
    until ($line =~ /^READY/) {
        $line = <$sock>;  
        print $line, "\n";
    }
    print "
"; # This part prints out fine! But after, the web client hangs. print $sock (@command, "\n"); while ( $line = <$sock> ) { push @output, $line; } print $sock "BYE\n"; close $sock or die "Can't close socket: $!"; print h2("No response from server $host!
") unless @output; print h2('Server responded:'), pre(@output); footer(); # This all prints if I kill the server }