metaperl has asked for the wisdom of the Perl Monks concerning the following question:
As you can see below, even with package scope, there is no data in @out, even though it is a package variable:
#!/usr/bin/perl -w use strict; use warnings; use Parallel::ForkManager; use LWP::Simple; my $pm=new Parallel::ForkManager(10); my @in = 1..5 ; our @out; for my $link (@in) { $pm->start and next; sleep rand 50 ; die if $link == 2 ; push @out, $link ; $pm->finish; }; $pm->wait_all_children; warn "@out"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Easy shared data for forked processes?
by shmem (Chancellor) on May 20, 2009 at 13:56 UTC | |
|
Re: Easy shared data for forked processes?
by Anonymous Monk on May 20, 2009 at 13:41 UTC | |
|
Re: Easy shared data for forked processes?
by morgon (Priest) on May 20, 2009 at 15:05 UTC | |
|
Re: Easy shared data for forked processes?
by metaperl (Curate) on May 20, 2009 at 19:09 UTC |