My error is as follows
You cannot start another process while you are in a child process, on the page / usr / lib / perl 5 / site_perl / 5.8.6 / Parallel / ForkManager.pm, line 463.
The part of my code that is having problems is below, below my code there is a routine that does not work in forkmanager, I canβt understand why. Without forkmanager, I can work fine.
my $pm = new Parallel::ForkManager($MAX_PROCESSES); for (0..$SCOUNT) { my $pid = $pm->start and next; my %shash = (); %shash = ( ID => "$SREF->[$_]->[0]", typeID => "$SREF->[$_]->[1]", extIP => "$SREF->[$_]->[2]", intIP => "$SREF->[$_]->[3]", NAME => "$SREF->[$_]->[4]", buTYPE => "NULL" ); if ($shash{typeID} =~ /^(4|16|17|25|27|28|42|49|50|51|54|58|60|63|19)$/){$shash{buTYPE} = 'LINUX DEDICATED';} if ($shash{typeID} =~ /^(11|14|22|32|34|36|37|46)$/) {$shash{buTYPE} = 'LINUX FULL';} if ($shash{typeID} =~ /^(44)$/) {$shash{buTYPE} = 'EMAIL MARKETER';} if ($shash{typeID} =~ /^(43)$/) {$shash{buTYPE} = 'TYip1';} if ($shash{typeID} =~ /^(45)$/) {$shash{buTYPE} = 'DDDOMAINS';} if ($shash{typeID} =~ /^(56)$/) {$shash{buTYPE} = 'AT MAIL';} if ($shash{typeID} =~ /^(65|66)$/) {$shash{buTYPE} = 'ENT MAIL';} if ($shash{typeID} =~ /^(1|3)$/) {$shash{buTYPE} = 'LINUX PROD';} if ($shash{buTYPE} eq 'LINUX DEDICATED' || $shash{buTYPE} eq 'LINUX FULL')
Encoding ForkManager.pm.
sub start { my ($s,$identification) =@ _; die "Cannot start another process while you are in the child process" if $s->{in_child}; while ($s->{max_proc} && ( keys %{ $s->{processes} } ) >= $s->{max_proc}) { $s->on_wait; $s->wait_one_child(defined $s->{on_wait_period} ? &WNOHANG : undef); }; $s->wait_children; if ($s->{max_proc}) { my $pid=fork(); die "Cannot fork: $!" if !defined $pid; if ($pid) { $s->{processes}->{$pid}=$identification; $s->on_start($pid,$identification); } else { $s->{in_child}=1 if !$pid; } return $pid; } else { $s->{processes}->{$$}=$identification; $s->on_start($$,$identification); return 0;
source share