BigJoe has asked for the wisdom of the Perl Monks concerning the following question:
In my script I have a place where I run chunks of code and being that I am a lazy programmer I would like to capture STDOUT and combine it with any data I decide to return.
--BigJoe
Learn patience, you must.
Young PerlMonk, craves Not these things.
Use the source Luke.
When I run this using Komodo or command line it works just fine but when I run the script in Apache it doesn't display anything. Like the STDOUT is still tied. I am running Apache 1.3.x on Linux.sub foo { my $captured_printed_data; my $SH = tie *STDOUT, 'IO::Scalar', \$captured_printed_data; $return_data = eval $module_code; $return_data = "$captured_printed_data \n$return_data" if(defined($c +aptured_printed_data) || ($captured_printed_data ne '')); close $SH; untie *STDOUT; return $return_data; }
--BigJoe
Learn patience, you must.
Young PerlMonk, craves Not these things.
Use the source Luke.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO::Scalar on Apache Weirdness
by Zaxo (Archbishop) on Oct 09, 2002 at 20:10 UTC | |
by BigJoe (Curate) on Oct 09, 2002 at 20:33 UTC | |
Re: IO::Scalar on Apache Weirdness
by Chmrr (Vicar) on Oct 10, 2002 at 01:43 UTC | |
by BigJoe (Curate) on Oct 10, 2002 at 12:41 UTC | |
by BigJoe (Curate) on Oct 10, 2002 at 13:25 UTC | |
Re: IO::Scalar on Apache Weirdness
by blahblahblah (Priest) on Oct 10, 2002 at 02:31 UTC |
Back to
Seekers of Perl Wisdom