Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: forking and dbi

by Mr. Muskrat (Canon)
on Dec 12, 2002 at 22:29 UTC ( #219449=note: print w/replies, xml ) Need Help??


in reply to forking and dbi

It appears to me that you are executing parent code in both the parent and the child.

I stripped your code down considerably and placed some print statements in there... Also added code so that it would work without the dbi stuff.

my @array = qw(1 2 3); my $switch_ref = \@array; for (my $count = 0; $count < @$switch_ref; ++$count) { my $switch = $switch_ref->[$count]; my $pid; if ($pid = fork) { push @pids, $pid; } elsif (defined $pid) { print "Child: $pid\n"; } else { die "Fork failed: $!\n"; } } foreach my $pid (@pids){ waitpid($pid,0); } print "parent: exiting.\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219449]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2022-08-10 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?