pipe (READ,WRITE); WRITE->autoflush(1); my $pid = fork(); if ($pid==0) { close(WRITE); fcntl(READ, F_SETFL(), O_NONBLOCK); main("start",""); while (1) { my $data_read = ""; if (defined(sysread(READ, $data_read,$maxBuffer))) { chomp($data_read); print "$data_read"; XMLparse($data_read); } } } else { close(READ); while (1) { my $data_write = ""; my $nval = $server->recv($data_write, $maxBuffer, 0); if (defined($nval) && length($data_write)) { print "$data_write"; print WRITE $data_write,"\n"; } } } close($server); exit(0);