I should have mentioned that I tried IO::Scalar. The following code causes a page fault in perl56.dll.
use IO::Scalar; print "Trying ioscalar...\n"; my $io = ioscalar(); print "Finished with ioscalar.\n"; print $io; print "Testing STDERR...\n"; print STDERR "(STDERR) can you hear me now?\n"; sub ioscalar { my $data; *oldfh = select STDERR; # save STDERR print "STDERR saved.\n"; my $SH = new IO::Scalar \$data; print "\$SH created.\n"; open(STDERR, '>', $SH) || die "Can't redirect STDERR to the IO::Scal +ar, $!"; print "STDERR redirected to \$SH\n"; select(STDERR); $| = 1; print STDERR "ioscalar says 'hi'\n"; close(STDERR); open(STDERR, ">&oldfh"); # restore STDERR select(STDOUT); return $data; } __DATA__ Trying ioscalar... STDERR saved. $SH created.
In reply to Re: Re: Best Way to Redirect STDERR to a Scalar
by Mr. Muskrat
in thread Best Way to Redirect STDERR to a Scalar
by Mr. Muskrat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |