in reply to Re: Re: Using perl to call a shell command?
in thread Using perl to call a shell command?

I believe you are referring to fork(), and exec(), not system()

So if you don't think system() does a fork() and an exec(), what do you think it does?

Update: Sorry MarkM I hadn't taken the time to understand your point properly. My experience of 500 server errors resulting from no autoflush dates back possibly as far as 5.001 and may have only been under IIS 2.0 on Windows - it's a habit I've carried for a while and can probably drop. The conclusion: Don't mess unnecessarily with $| in your CGI scripts - it won't improve efficiency.

  • Comment on Re: Re: Re: Using perl to call a shell command?

Replies are listed 'Best First'.
Re: Re: Re: Re: Using perl to call a shell command?
by MarkM (Curate) on Mar 08, 2003 at 08:15 UTC

    The difference is that at one point in time, Perl fork() (different from C fork()) did not flush the handles, and any output sent after fork() may be flushed from both parent and child resulting in double output. system() never had this behaviour because system() was not implemented in terms of Perl fork() and Perl exec().

    My real question to you is: What sort of buffering problem do you see $| = 1 solving for system() calls? I say none, and suspect you are referring to the earlier problems with Perl fork(). What say you?