We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

perl, Open and close STDOUT

rgbcof
rgbcof asked
on
Medium Priority
914 Views
Last Modified: 2012-05-11
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.
Comment
Watch Question

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

Author

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?
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Your last line did work.  Thank you.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.