in reply to Re: Best Way to Redirect STDERR to a Scalar
in thread Best Way to Redirect STDERR to a Scalar
Tested with the following code it fails the "warn test" and testing versus Mr. Muskrat's target Devel::Peek:
produces outputuse IO::Capture::Stderr; use Devel::Peek; my $data; print STDERR " STDERR test (1)\n"; my $capture = IO::Capture::Stderr->new(); $capture->start(); print STDERR " STDERR test (2)\n"; warn " STDERR test (2a)"; my $test = 'string'; Dump($test); $capture->stop(); print STDERR " STDERR test (3)\n"; my @the_output = $capture->read; if( @the_output ) { foreach (@the_output) { print " >>> ", $_; } }
STDERR test (1) STDERR test (2a) at mrmskrat4.pl line 15. SV = PV(0x183ec0c) at 0x197138c REFCNT = 1 FLAGS = (PADBUSY,PADMY,POK,pPOK) PV = 0x196deb4 "string"\0 CUR = 6 LEN = 7 STDERR test (3) >>> STDERR test (2)
|
|---|