Basically that's all it does. When i execute it, It forks one child and dies on this lineuse IPC::ShareLite; use Storable qw(freeze thaw); use POSIX qw(:sys_wait_h); my $share = new IPC::ShareLite( -key => 'link', -create => 'yes', -destroy => 'yes', -size => 262144, -mode => 0660, ) or die "Cannot create segment: $!"; my $arrayref; # the array i want to share with my children push @{$arrayref}, 'some value'; $share->store(freeze($arrayref) ); if ($pid = fork()) { #************* parent ++$num_procs; ++$flag; print "$num_procs processes running\n"; } elsif (defined $pid) { #************* child my $alllinks; my @temp_array; $alllinks = thaw( $share->fetch() ); # fetch the global array +from memory THIS IS THE LINE THAT'S GIVING ME AN ERROR foreach $blah (@hrefs) { $blah = url($blah, $base)->abs; if ($blah =~ m/^http:(.*)[|\.]$localdomain[\/|:|]/i) { $found = 0; for (@{$alllinks}) { (split /^/, $_)[0] eq $blah and $found++, last } if ($found == 0) { push @temp_array, $blah; } } } $share->lock("LOCK_EX"); # obtain an exclusive lock on the sh +ared memory segment push @{$alllinks}, @temp_array; # modify the global array $share->store( freeze($alllinks)); # store it back into shared + memory $share->lock("LOCK_UN"); # unlock it exit; # always exit the child } else { # can't fork }
Has anyone used this module before ? Successfully ?
Please give me some insight, I'm pulling my hair here.
Show me some sample scripts, anything.
Thanks in advance for any input.
- DAFT PUNK ARE ROBOTS
In reply to Problems with IPC::ShareLite by raxor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |