albert has asked for the wisdom of the Perl Monks concerning the following question:
With some help from the Monks, things work now as I want them as a stand-alone CGI. However, I'm now trying to do the same thing under mod_perl. I now see that STDOUT is tied in mod_perl, which prevents this techique from working there. What would be the best approach to get gzipped output from my script under mod_perl?use Compress::Zlib; if($out eq 'gz'){ binmode STDOUT; print("Content-type: application/x-gzip\n\n"); my $gz = gzopen(\*STDOUT, "wb") or die "Cannot open stdout: $gzerrno\n" ; foreach my $line (@lines){ $gz->gzwrite($line) or die "error writing: $gzerrno\n" ; } $gz->gzclose; }
-a
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: STDOUT and mod_perl
by philcrow (Priest) on Aug 29, 2006 at 14:17 UTC | |
|
Re: STDOUT and mod_perl
by Anonymous Monk on Aug 29, 2006 at 13:39 UTC | |
by albert (Monk) on Aug 29, 2006 at 13:49 UTC | |
by Anonymous Monk on Aug 29, 2006 at 14:40 UTC |