J
J Krugman
I'm using a module whose subs all write to STDOUT. I want to
capture the output of these subs in a Perl string instead. My
boneheaded (i.e. failed) attempt to solve this problem was:
use IO::Scalar;
my $string;
*HOLD = *STDOUT;
$STRING = IO::Scalar->new(\$string);
*STDOUT = *STRING;
foo(); # prints to STDOUT; output should be in $string ???
*STDOUT = *HOLD;
What's the correct way to do what I want to do?
Thanks!
jill
capture the output of these subs in a Perl string instead. My
boneheaded (i.e. failed) attempt to solve this problem was:
use IO::Scalar;
my $string;
*HOLD = *STDOUT;
$STRING = IO::Scalar->new(\$string);
*STDOUT = *STRING;
foo(); # prints to STDOUT; output should be in $string ???
*STDOUT = *HOLD;
What's the correct way to do what I want to do?
Thanks!
jill