Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The code runs fine, but it doesn't run any of the SQL statements, if I remove the Parallel::ForkManager stuff, it runs fine. Hope the monks know :-)my $pm = new Parallel::ForkManager(4); foreach my $bccperson (@bccppl) { if ($xcount > 49) { sleep 5; $xcount = 0; } $pm->run_on_start( sub { $scount++; print "Sending Msg:$mjobno:$scount:$bccperson\n"; } ); $pm->run_on_finish( sub { $xcount++; } ); my $pid = $pm->start and next; my $msg = MIME::Lite->new( From => $from, To => $bccperson, Subject => $subject, #Type => 'text/html', Type => 'text', Data => $body ) || print "MIME::Lite new error: $bc +cperson\n"; #$msg->print_body; MIME::Lite->send('smtp', '10.10.10.10', Timeout=>240); $msg->send() || print "Couldn't send to: $bccperson\n"; $pm->finish; } #End of foreach $bccperson $pm->wait_all_children; print "Connecting for insert into jobs_run: JOBNO:$mjobno\n"; my $sql4 = qq { insert into jobs_run (jobname, datein, howmany, error +mesg) values ( 'attachmailer', sysdate, $scount, 'JOBNO:$mjobno')} | +| warn "Error: $!\n"; print "preparing Query"; my $sth4 = $dbh->prepare( $sql4 ) || warn "Prepare Error: $!\n"; print "executing Query"; $sth4->execute() || warn "Execute Error: $!\n"; print "Done";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Parallel::ForkManager - doesn't run code after
by kvale (Monsignor) on Jun 28, 2002 at 15:44 UTC | |
by Anonymous Monk on Jun 28, 2002 at 16:09 UTC |