http://www.perlmonks.org?node_id=1048172

glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question:

Greetings,

I was trying to use IPC::Open3 in a Windows 7 but I was getting the complaint below:

readline() on unopened filehandle

I found it intriguing since if I use the same program to fork a child process with IPC::Open2 it works as expected. Seems to be that STDERR is not being assigned as it would be expected.

To be sure, I wrote the two following scripts for testing:

use warnings; use strict; use feature 'say'; say 'foobar'; warn 'this is a warning';

And called it "dummy.pl".

Then I wrote:

use warnings; use strict; use IPC::Open3; use feature qw(say); my ( $wtr, $rdr, $err ); my $pid = open3( $wtr, $rdr, $err, 'perl', 'dummy.pl' ); while (<$rdr>) { print $_; } while (<$err>) { print $_; } close($err); close($rdr); close($wtr); waitpid( $pid, 0 );

After executing it, this is what I got:

c:\Temp>teste.pl this is a warning at dummy.pl line 7. foobar Use of uninitialized value $err in <HANDLE> at C:\Temp\teste.pl line 1 +5. readline() on unopened filehandle at C:\Temp\teste.pl line 15.

It looks like a bug, doesn't it?

I'm using Windows 7 Service Pack 1 with:

This is perl 5, version 16, subversion 3 (v5.16.3) built for MSWin32-x +86-multi-thread
Alceu Rodrigues de Freitas Junior
---------------------------------
"You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill