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

I have activestate perl installed on a w2k server running iis. Scripts run from the commandline open files without difficulty, but not when run as a cgi. the die() statement produces no output. I am using an absolute path. Permissions are such that the server has permision to open the file. (For example a cgi written in a different language can open the same file.) Any ideas?
  • Comment on Not the obvious - opening files with activestate perl

Replies are listed 'Best First'.
Re: Not the obvious - opening files with activestate perl
by ignatz (Vicar) on Jun 10, 2002 at 20:18 UTC
Re: Not the obvious - opening files with activestate perl
by rbc (Curate) on Jun 10, 2002 at 20:16 UTC
    have you consider the possibilty that this may be a iis configuration issue
    instead of a perl code issue?
Re: Not the obvious - opening files with activestate perl
by Jenda (Abbot) on Jun 10, 2002 at 23:06 UTC

    Create a minimal failing script and post it here, please.

      Jenda@Krynicky.cz

Re: Not the obvious - opening files with activestate perl
by strat (Canon) on Jun 11, 2002 at 10:54 UTC
    Some years ago I had similar problems with IIS (and also Apache) and paths under WindowsNT (but never under Linux or Solaris). The problem was that the script didn't know which was the actual directory (it was webroot for some users), and even using an absolute directory didn't help. I overcame this problem by using some environmentvariables to find out the actual path: either DOCUMENT_ROOT and SCRIPT_NAME or SCRIPT_FILENAME (I can't remember exactly) (and killed the filename).

    I found the problem by using opendir(DIR, "./") and printing the filenames of that directory.

    Perhaps, use FindBin qw($Bin); my $scriptDir = $Bin; might work to "set" the actual directory to the directory where the cgi-script is situated and then work with relative paths. (I just didn't know this solutions some years ago).

    Maybe there are better solutions, but for I hardly write Webapplications, I don't know much about webservers and the like...

    Best regards,
    perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v8.8.8.32.11.32"

Re: Not the obvious - opening files with activestate perl
by talexb (Chancellor) on Jun 11, 2002 at 13:26 UTC
    To echo strat's answer, write the simplest possible CGI that displays the current directory. You can use pwd on Linux, and cd on Windows NT.

    I have come across the same problem -- building a web site on Windows NT can be a gruesome experience. Sort of like getting back into dating after a failed marriage, it's a mixture of excitement and horror.

    --t. alex

    "Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny

      I wonder ... dating ever was anything but horror?

        Jenda@Krynicky.cz