saintmike has asked for the wisdom of the Perl Monks concerning the following question:
But what if a new process gets spawned after the tie(), is there a way to avoid the warning? Like in
which printsuse strict; use warnings; use IPC::Shareable; my $scalar; my $foo = tie $scalar, 'IPC::Shareable', 'k123', { create => 1, destroy => 1 }; my $pid = fork(); if(! defined $pid) { die "fork err"; } elsif($pid == 0) { # Child undef $foo; untie $scalar; print "Child ends\n"; exit 0; } else { # Parent sleep(1); undef $foo; untie $scalar; print "Parent ends\n"; }
untie attempted while 1 inner references still exist at ./test.pl line 17. Child ends untie attempted while 1 inner references still exist at test.pl line 24. Parent endsSure, no warnings would suppress the warning. Other options (besides calling tie() after the fork())?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Unavoidable "untie attempted while inner references" with fork()?
by ysth (Canon) on Jul 18, 2006 at 23:45 UTC | |
by saintmike (Vicar) on Jul 18, 2006 at 23:57 UTC |