Hi everyone,

    I am forking and it looks like when my foreach loop is completeed it
dies without going to the next if statement:




I have:

foreach my $usr (@users) {
      my $UsrPid;
      unless ($UsrPid = fork) {
            while fork {
                  do stuff
                  exit 0;
            }
            exit 0;
       }
       waitpid($UsrPid,0);
} 
if (defined @otherusers)
      foreach my $usr2 (@otherusers) {
            my $oUsrPid;
            unless ($oUsrPid = fork) {
                   while fork {
                          do stuff
                          exit 0;
                   }
                   exit 0;
             }
             exit 0;
       }
       waitpid($oUsrPid,0);
}

    This is in a sub routine.  But after it does stuff with $Usr it
exists out of the sub and goes to the next one.  IT does not contiue
with the if (define @otherusers).

    I know @otherusers exist because I log them into a mysql databases a
few lines before the first foreach loop.  I think it has something to do
with how I end my fork.

Anyone have any suggestions why it's dying?  Do I have my exit 0; in the
proper location?

Thanks again for all the great help.

--chad


-- 
Chad Kellerman
Jr. Systems Administrator
Alabanza Inc
410-234-3305

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to