On Wed, Sep 11, 2002 at 12:17:55PM -0400, Chad Kellerman wrote:

> Hey,
> 
>     I got a script that I use Parallel::ForkManager, which works
> great...
> the only problem is that I want a child to fork another process and
> Parallel::ForkManager does not allow that.

I've never used this module.

>   So for my first fork I use it but in the child I am trying to use the
> normal oreilly FORK but I am missing something stupid.

And I've never heard of an oreilly FORK.

> 
> my @list = "bla, bla, bla, bla, bla";
> foreach my $item(@list) {
>         my $pid;
>         FORK: {
>             if ($pid=fork) {
>                    print"$pid\n";
>             }elsif (defined $pid){
>              #do other perl stuff to $item
>             exit 0;
>             } elsif ($! =~/No more process/) {
>             sleep 5;
>             redo FORK;
>             }
>        } 
> }
> 
>    What I want to do, is have the fork, process $item before it goes
> onto the next $item.  But as it is written it forks every $item in the
> @list.

Yes, that's what you have programmed.

>    Just fork, finish, repeat until all $item are done.
> 
> Can any offer any suggestions?

I presume there is some reason for doing the fork that you are not
telling us.

Maybe you should be doing a wait() or waitpid().

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to