in reply to Re^2: using tie on two arrays on IPC::Shareable makes array1 and array2 both same even though array2 is not updated.
in thread using tie on two arrays on IPC::Shareable makes array1 and array2 both same even though array2 is not updated.
#!/usr/bin/perl -w use strict; use warnings; use IPC::Shareable qw( ); my @array1; my @array2; my %options = ( create => 1, exclusive => 0, mode => 0644, destroy => 1, ); my $handle1 = tie @array1, 'IPC::Shareable', 'data', \%options; my $handle2 = tie @array2, 'IPC::Shareable', 'kala', \%options;
You also seem to forgot to connect to the share in the children. It's not documented to be inheritable.
You might have a problem where the child destroys the share when it exits. That's why forked children should use POSIX::_exit. An alternative is to set destroy => 0 and call IPC::Shareable->clean_up; before exiting the parent.
|
|---|