Thanks
NetWallah for the debug information, now I have something to start with.
I changed the tie() variable to a simple scalar, so that it will be go through shareable, and tested again, the following code, almost exactly the same as before, works with no problems. So I guess the problem is really in Shareable.
#!C:/Perl/bin/perl -w
use strict;
use Win32::MMF;
use Win32::MMF::Shareable;
if( fork )
{
my $ns = tie( my $share, 'Win32::MMF::Shareable', 'share' ) || die;
sleep(1);
$share = 'PARENT';
}
else
{
my $ns = tie( my $share, 'Win32::MMF::Shareable', 'share' ) || die;
$share = 'CHILD';
}
Now the question comes down to why Storable is causing Perl to crash? Is the Storable module thread safe? Is there a thread safe alternative?
Update:
I have tried
BrowserUk's suggestion and the problem seems to have gone away. I am currently investigating on why having
require in each process after fork cures the problem.