in reply to Re^2: explain my code
in thread explain my fork

use strict; use warnings; print "FIRST\n"; fork(); print "SECOND\n";
Outputs:
FIRST SECOND SECOND

It would therefor appear that it DOES execute that command twice. If you think it does not, please supply what you are using as evidence so that we might see what you are doing differently.


___________
Eric Hodges

Replies are listed 'Best First'.
Re^4: explain my code
by qbxk (Friar) on Jun 23, 2006 at 15:24 UTC
    I agree, your example is correct, that's how fork works.

    My demo above is what i'm doing. If I run that from the command line, it executes twice, yes. But if apache executes it, some_cmd is only executed once. I expect it has something to do with my close STDOUT line, which in a normal script apparently is a synonym for exit() (when run by apache). So, really, I don't understand why it ran some_cmd once, when it should have been either none or twice, I could rationally explain either of those outcomes

    It's not what you look like, when you're doin' what you’re doin'.
    It's what you’re doin' when you’re doin' what you look like you’re doin'!
         - Charles Wright & the Watts 103rd Street Rhythm Band, Express yourself