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

I asked this question earlier, but I'm afraid I wasn't clear enough. I'll try and rephrase the question. I got 2 very good replys but niether really addressed the problem.

Inside of a IIS5 cgi application I run a system call

system($prg);
This app has been moved to IIS6 and the above call fails silently (also with backtics). In a futile attempt to gain some insight as to is going on, I changed the system to an open
open (POO, "logfile") or die "Can't open logfile: $!"; my $PRG = "someprg.bat |"; print POO $PRG; open (HUH, $PRG) or die "Can't run someprg.bat: $!"; while (<HUH>) { print POO $_; }
When run I die and get "Bad file discriptor" in $! on the open statment. This works in IIS5 and Apache, not IIS6. I'm not a windows user and I'm not really sure where to go next. I'm not sure what to make of the 'bad file discriptor' message, and was wondering what was wrong with my use of open, or if any one knew why IIS6 has decided to change the rules? (and what those new rules might be)

PS using XML::ApacheFOP was suggested but I have no control over the server, and was hoping for something I could do remotly.

Replies are listed 'Best First'.
Re: open under windows IIS6
by BrowserUk (Patriarch) on Feb 27, 2006 at 22:39 UTC

    That 'Bad file descriptor' msg turns up in $! quite often when there is no error, or after error conditions that could have nothing whatever to do with a file descriptor. For example, if you do

    >perl -wle "eval{ use Data::Dumper }; print $Data::Dumper::VERSION; pr +int $!" 2.121_02 Bad file descriptor

    There it is like a bad penny, even though nothing whatever failed in the code.

    I'd try printing out $^E and see what light that sheds.

    I'd guess that you will get "Permission denied", probably because the IIS6 default user id has changed (*a guess?) from that used by IIS5 and so whatever additional permissions were given to the old userid that allowed it to see the file/directories involved have never been given to the new one. All total speculation, but worth a mention.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: open under windows IIS6
by ikegami (Patriarch) on Feb 27, 2006 at 21:19 UTC
    • Maybe you're not in the directory you think you are. Try using the full path to the .bat file.

    • Treating a batch file as an executable had and might still have issues. You could try running cmd someprg.bat instead of just someprg.bat.