I am trying to write a unit test for a client server application. To test the client, in my unit test, I want to first start my tcp server (which itself is another perl file). I tried to start the TCP server by forking:
if (! fork()) {
system ("$^X server.pl") == 0 or die "couldn't start server"
}
So when I call make test
after perl Makefile.PL
, this test starts and I can see the server starting but after that the unit test just hangs there. So I guess I need to start this server in background and I tried the &
at the end to force it to start in background and then test to continue. But, I still couldn't succeed. What am I doing wrong? Thanks.