Hi,

I've had this problem before, but never got to the bottom of it.

I'm cursed with a situation in which I need to run some .exe file from a
(mod)perl script.  The program concerned is a console application so it
just writes its output on STDOUT.  I need to re-direct that output to a
temporary file, and then read the file in to process in the perl script.

Sounds simple enough, and it works fine running Apache without
mod_perl.  But as soon as I put mod_perl into the equation I find that I
can't re-direct STDOUT in the system() call.  The following script
illustrates the problem:

    print "Content-Type: text/html\n\n";
    $status = system "D:\\WINNT\\system32\\ipconfig.exe >
D:\\Temp\\ip.txt";
    print "The system() call exited with status $status.\n";

Without mod_perl this works fine: "ip.txt" is created and $status is 0.
But with mod_perl "ip.txt" is not created, $status is 256 and the
following line appears in error.log:

    The handle could not be opened
    during redirection of handle 1.

Can anyone help?


My setup is as follows:

- NT 4 Workstation, Service Pack 6

- Perl 5.005_03 built with VC++ 6 and the Makefile options:
    CFG = Optimize
    USE_PERLCRT
    PERL_MALLOC

- Apache 1.3.12 built with VC++ 6

- mod_perl 1.22 built with VC++ 6

- D: is a local disk which I have full access to


I've found that the problem goes away if I downgrade to Apache 1.3.6 and
keep everything else the same!


Steve Hay


Reply via email to