Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: forking and dbi

by Mr. Muskrat (Canon)
on Dec 12, 2002 at 22:29 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found