http://qs321.pair.com?node_id=204085


in reply to IO::Scalar on Apache Weirdness

I've used IO::Scalar in cgi scripts on apache before, and your code looked pretty similar to mine, so I thought I'd see what was different. In my code I never did anything with the return value from tie, and I think that's what's breaking for you. It's the "close $SH" line that's the problem. I tried the following script on my apache, and did not see any output:
#!/usr/local/bin/perl print "Content-type: text/html\n\n"; use IO::Scalar; my $output; my $SH = tie *STDOUT,'IO::Scalar', \$output; print "hey\n"; $result = "output: $output"; close $SH; untie *STDOUT; print $result;
Then I commented out the "close" line, and it worked! I'm not sure why -- I would have expected to at least see "output:" no matter what.