Hello, I have a problem when using exec() with ActiveState perl on Windows: it seems STDIN becomes multiplexed between the console and the perl program as soon as I call exec().
Here is a simple program to show what I mean:
use warnings;
use strict;
if(! $ENV{TEST}) {
$ENV{TEST}=1;
exec {$^X} ($^X,$0);
}
while(my $input=<STDIN>) {
chomp($input);
last unless($input);
print "You typed: \"$input\"\n";
}
print "Exiting\n";
And here is the output when I just launch this program and try to enter "test1", "test2", "test3", "test4", "test5", and then the empty string to exit:
D:\test>perl test.pl
D:\test>test1
'test1' is not recognized as an internal or external command, operable
+ program or batch file.
D:\test>test2
You typed: "test2"
test3
'test3' is not recognized as an internal or external command, operable
+ program or batch file.
D:\test>test4
You typed: "test4"
test5
'test5' is not recognized as an internal or external command, operable
+ program or batch file.
D:\test>
Exiting
On the other hand, if I run this program on Linux it works perfectly:
~/test$ perl test.pl
test1
You typed: "test1"
test2
You typed: "test2"
test3
You typed: "test3"
test4
You typed: "test4"
test5
You typed: "test5"
Exiting
~/test$
Any idea about what is causing this? Is there any known workaround for this problem?
Thanks.