in reply to Cgi , fork , output data

This doesn't work because of:
if(kill(0,$Kind_pid)) {
You are checking whether the child is alive. It is, so you go into this if block. However, both the parent and the child go into this block, whereas it is your intention to have only the parent get into this block, and have the child execute the else block. Change this line to:
if ($Kind_pid) {
and watch the dots march across the screen :).

If you are worried about not properly forking, you can always check for the child's existence (with kill 0) inside the parent's if block.

Update: Better yet, if you are worried about not forking properly, check for the definedness of the return value of fork:

die "Could not fork: $!\n" unless (defined(my $Kind_pid = fork() ));

CU
Robartes-

Replies are listed 'Best First'.
Re: Re: Cgi , fork , output data
by jreades (Friar) on Mar 11, 2003 at 10:28 UTC

    Additionally, it's worth noting that even if your code works, it might not work in a Web environment -- although most browsers have gotten 'smart' about rendering the page as they receive the content since it looks faster, to my knowledge they are under no obligation to do so. You might consider using a refresh instead.

      it's run on a web!!! test
Re: Re: Cgi , fork , output data
by tzvik (Initiate) on Mar 11, 2003 at 10:46 UTC
    Tank's it work