in reply to In the BEGINing there were no forks?

Windows' fork emulation is just an emulation, and it shows a bug there. With a genuine fork you sould see:

inner outer inner outer
or a possible but unlikely reversal of the middle two. Fork produces two processes where there was one, each continuing from the location of fork. Both processes see and do both print statements. Here's a version which skips "outer" for the child.
BEGIN { my $cpid = fork; print "inner\n"; exit 0 unless $cpid; } print "outer\n";
It would be more to the point to ask if Windoew' emulation can be fixed to match the real thing.

Update: Oh, that's what you were asking. </sigh>

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: In the BEGINing there were no forks?
by Anonymous Monk on Feb 14, 2005 at 20:17 UTC
    I think you got the wrong end of the stick there. The desired behaviour is the correct, UNIX style forking. I don't want to fix UNIX to be like Windows in the code, but the other way around. Is it possible to improve the emulation from within the code itself?