<?xml version="1.0" encoding="windows-1252"?>
<node id="930780" title="Re^2: STDERR going to string" created="2011-10-11 06:37:11" updated="2011-10-11 06:37:11">
<type id="11">
note</type>
<author id="914294">
philkime</author>
<data>
<field name="doctext">
I had something like this too but it doesn't work on Windows. Here is a stripped down example using Inline::C. On non-Windows (cygwin included), it outputs correctly:

|ERROR|

On Windows, it gives:

||
ERROR

which shows you that the STDERR isn't being captured.

&lt;code&gt;
use File::Temp qw(tempfile);
use Inline C;

open my $olderr, '&gt;&amp;STDERR'; # save STDERR
my ($fh, $fn) = tempfile();
open STDERR, '&gt;&amp;', $fh;

test_err();

open STDERR, '&gt;&amp;', $olderr; # reset STDERR
close $fh;

open my $e, '&lt;', $fn;
my $err = &lt;$e&gt;;
print "|$err|\n";

__END__
__C__
void test_err()
{
(void)fprintf (stderr, "ERROR");
}

&lt;/code&gt;
</field>
<field name="root_node">
929318</field>
<field name="parent_node">
930768</field>
</data>
</node>
