Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jeff Pang
>Thanks Jay and Tom! I added this little bit to my script: > >select (CHILD); >$| = 1; >select (STDOUT); > >and it worked just as I expected it to. It's interesting, though, >that I've been working with sockets a bunch through IO::Socket and my >print statements seem to print to the socket strea

Re: Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jay Savage
On 11/8/06, Jen Spinney <[EMAIL PROTECTED]> wrote: Thanks Jay and Tom! I added this little bit to my script: select (CHILD); $| = 1; select (STDOUT); and it worked just as I expected it to. It's interesting, though, that I've been working with sockets a bunch through IO::Socket and my print

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jen Spinney
On 11/8/06, Jay Savage <[EMAIL PROTECTED]> wrote: There are a couple of things going on here. First, the issue of what prints when is driven by buffering. Since you haven't turned on autofulsh on any of your file handles, the buffer is flushed whenever it's convenient for the the system. The res

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Tom Phoenix
On 11/8/06, Jen Spinney <[EMAIL PROTECTED]> wrote: print CHILD "printing to child\n"; sleep 5; Concurrent processes can be counterintuitive at times. Because the CHILD filehandle is buffered, that line won't necessarily be sent to the child process right away. In your program, I'd expe

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jay Savage
On 11/8/06, Jen Spinney <[EMAIL PROTECTED]> wrote: use strict; use warnings; print "First Trial:\n\n"; if (open(CHILD, "|-")) { print "parent starts: ", (scalar localtime),"\n"; sleep 5; print "parent ends: ", (scalar localtime),"\n"; } else { print "child starts: ", (scalar l

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jen Spinney
On 11/8/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Jen Spinney wrote: > Hello all! Hello, > print "\nSecond Trial:\n\n"; > > if (open(CHILD, "|-")) > { >print "parent starts: ", (scalar localtime),"\n"; >print CHILD "printing to child\n"; >sleep 5; >print "parent ends: ", (sca

Re: Trying to understand this forking open stuff...

2006-11-08 Thread John W. Krahn
Jen Spinney wrote: > Hello all! Hello, > print "\nSecond Trial:\n\n"; > > if (open(CHILD, "|-")) > { >print "parent starts: ", (scalar localtime),"\n"; >print CHILD "printing to child\n"; >sleep 5; >print "parent ends: ", (scalar localtime),"\n"; > } > else > { >my $time = sc