On Mon, Sep 23, 2002 at 10:33:04AM -0400, Peter Chen wrote:
> Rocco,
> 
> One of my coworkers who uses my POE-based framework discovered an
> interesting semantic difference between using POE::Wheel::Run running a
> Perl function vs. the typical fork-exec.
> 
> Observe the results of these two one-liners:
> 
> perl -e 'rand; if (fork) { print rand } else { print rand }'
> 
> perl -e 'rand; if (fork) { print rand } else { exec("perl -e \"print
> rand\"") }'
> 
> W/o an exec, the first and second rand() will always produce the same
> result.
> 
> Would it make sense for POE::Wheel::Run to call srand before the perl
> function is executed in the child process?

While on the surface it seems like a useful thing, I tend to think
calling srand() is best left to the POE::Wheel::Run user.  Not
everyone needs random numbers in their child processes, and for many
it would just be one more bit of overhead.

-- Rocco Caputo / [EMAIL PROTECTED] / poe.perl.org / poe.sf.net

Reply via email to