in reply to Re: STDERR going to string
in thread STDERR going to string
use File::Temp qw(tempfile); use Inline C; open my $olderr, '>&STDERR'; # save STDERR my ($fh, $fn) = tempfile(); open STDERR, '>&', $fh; test_err(); open STDERR, '>&', $olderr; # reset STDERR close $fh; open my $e, '<', $fn; my $err = <$e>; print "|$err|\n"; __END__ __C__ void test_err() { (void)fprintf (stderr, "ERROR"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: STDERR going to string
by salva (Canon) on Oct 11, 2011 at 14:20 UTC | |
by philkime (Beadle) on Oct 11, 2011 at 15:29 UTC | |
by Anonymous Monk on Oct 11, 2011 at 16:12 UTC | |
by salva (Canon) on Oct 12, 2011 at 07:43 UTC | |
by BrowserUk (Patriarch) on Feb 17, 2012 at 07:29 UTC | |
by Anonymous Monk on Oct 12, 2011 at 08:35 UTC |