B
brian.mabry.edwards
Running Windows XP / ActivePerl v5.8.7
The following combination causes a permission denied failure:
* duplicate stdout in my script
* redirect stdout on command line
* run script with "name" instead of "perl name.pl"
I did the following to allow me to execute the script by name
* assoc .pl=Perl
* ftype Perl=c:\Perl\bin\perl.exe %1 %*
* set PATHEXT=%PATHEXT%;.pl
Simple example showing the failure.
testRedirect.pl
open(OUTCOPY, ">&STDOUT") or die "Couldn't dup STDOUT: $!";
close OUTCOPY;
print "Success!\n";
Works this way
C:\>perl
C:\da_home_eclipse30\NIL\test\regression-tests\bin\testRedirect.pl
C:\>type tmp\out.txt
Success!
And it works this way
C:\>testRedirect
Success!
Fails this way
C:\>testRedirect >tmp\out.txt
Couldn't dup STDOUT: Permission denied at
C:\da_home_eclipse30\NIL\test\regression-tests\bin\testRedirect.pl line
1.
Is there anything I can do to get this to work?
The following combination causes a permission denied failure:
* duplicate stdout in my script
* redirect stdout on command line
* run script with "name" instead of "perl name.pl"
I did the following to allow me to execute the script by name
* assoc .pl=Perl
* ftype Perl=c:\Perl\bin\perl.exe %1 %*
* set PATHEXT=%PATHEXT%;.pl
Simple example showing the failure.
testRedirect.pl
open(OUTCOPY, ">&STDOUT") or die "Couldn't dup STDOUT: $!";
close OUTCOPY;
print "Success!\n";
Works this way
C:\>perl
C:\da_home_eclipse30\NIL\test\regression-tests\bin\testRedirect.pl
tmp\out.txt
C:\>type tmp\out.txt
Success!
And it works this way
C:\>testRedirect
Success!
Fails this way
C:\>testRedirect >tmp\out.txt
Couldn't dup STDOUT: Permission denied at
C:\da_home_eclipse30\NIL\test\regression-tests\bin\testRedirect.pl line
1.
Is there anything I can do to get this to work?