perl, Open and close STDOUT

I am using perl for my cgi program.
I am using "$| = 1;" to autoflush.
However, autoflush is not working properly because of the web server I am using, so I had to close STDOUT force the outpout.

Now, I would like to reopen, reenable, or anything that would get STDOUT to work again.  
Note:  "open STDOUT" "open (STDOUT)" does not work.

Help.
rgbcofAsked:
Who is Participating?
 
DocSeltsamConnect With a Mentor Commented:
What error do you get when you try the last line to open STDOUT again?
0
 
DocSeltsamCommented:
Hi there,

first thing, have you these?
 
select STDOUT; $| = 1;  # make unbuffered

Open in new window


use IO::Handle;
STDOUT->autoflush(1);

Open in new window


To reopen STDOUT you have to the followinf I think

 
open STDOUT, '>-' or die "Can't open STDOUT: $!";

Open in new window


--TheDoctor
0
 
rgbcofAuthor Commented:
I forced the Web Server to autoflush with the command you gave above.  But it does not work because there is something wrong with webserver.  If i close STDOUT, then it will flush, but the problem is I can not reopen STDOUT again.  Help.  How do you re-open STDOUT after closing?
0
 
rgbcofAuthor Commented:
Your last line did work.  Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.