use Tk; use Server; use Client; my $mw = MainWindow->new(); #MainLoop; #gui appears but the control goes below only after closing the gui,hence server does not start when the gui is open print "after mainloop \n"; my $server = Server->new(parentWnd=>$mw); $server->initServer(); my $client = Client->new(parentWnd=>$mw); $client->initClient(); MainLoop; #does not bring up the gui but the server starts.