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

Allright, I'm trying to run a perl script through IIS5 on Win2k, using Active State Perl. Now, I can get perl to run through IIS, I can execute scripts, and for the most part, it seems cool.

But, when I try to write to a file (creating a new file and writing to it), it's just a no-go. No error message or anything. It works fine under the command line, and I've set up the directory permissions to allow read, write, execute for anyone (I know, a little insecure, but I'm just trying to get it to WORK). Basically, I'm executing the following code:
open(FOOBAR, '>foo') or die("$!\n"); print FOOBAR "foo\n";
Am I doing something wrong? Is there some little quirk or configuration issue I should know about? (Working mostly in linux, I don't know all the little in's-and-out's of IIS, but I'm stuck with it for this project)

Replies are listed 'Best First'.
Re: Active State / IIS write problem
by dws (Chancellor) on Jun 14, 2002 at 17:07 UTC
    IIS doesn't have error logs in the same way that Apache does, so you're going to need to make the error visible. Try   use CGI::Carp qw(fatalsToBrowser); This'll help you out during development, though you probably won't want it in for production code.

      actually, figured it out

      the problem was, i was expecting the file to be created in the same directory as the script (ie: the script is executed in the directory it resides in), but instead, it was in the root directory... :P

      thanks for the help, though
        Just an FYI on security. If you are taking uploaded files and putting them on the system, make a directory to put these files in and only have that dir writable and make sure it is not executable. Also make sure to strip out all slashes from the filename so they can not attempt to drop files where ever on the system.

        --BigJoe

        Learn patience, you must.
        Young PerlMonk, craves Not these things.
        Use the source Luke.
Re: Active State / IIS write problem
by runrig (Abbot) on Jun 15, 2002 at 23:26 UTC
    Are you using PerlScript and ASP? If so, you may want to use $Server->MapPath(). And then you may also want to see Matts Perl Pages (by our own Matts, not that other Matt) and his guide to PerlScript/ASP.
Re: Active State / IIS write problem
by Mr. Muskrat (Canon) on Jun 15, 2002 at 21:12 UTC
    Anytime I have coded something for IIS, I have had to use absolute paths and URLs.
    (Must be related to the twisted thinking of the Dark Side?)

    Who says that programmers can't work in the Marketing Department?
    Or is that who says that Marketing people can't program?