in reply to Converting Unix to NT

The question is: "Why won't it run on NT?" If you can give us some specific error messages, it would be helpful.

Because Perl is designed to be portable, it's often a matter of very specific OS features that cause the issues. Does your program compile? Do you have the right version of Perl? Did you remember to change the shebang line to point to your Perl compiler (boy, I can't tell you how many times I've been bitten by that bug).

If you can answer some of those questions and post those answers here, we can give you much better feedback -- but please don't post 1,000+ lines of code :)

Also, check here for a list of related Perlmonks nodes.

You can also check out this perl.com article which deals specifically with portability issues.

Cheers,
Ovid

Replies are listed 'Best First'.
RE: (Ovid) Re: Converting Unix to NT
by Anonymous Monk on Aug 22, 2000 at 09:44 UTC
    Well... No error messages. It just comes up blank and says "Done" at the bottom, but doesn't display the web page that it is supposed to, as it does on the unix box. I'm wondering if it may have to do with file locations - / vs. \. I changed the shebang line, but don't know if it's right. Do I need to specify a drive as well as directory? The perl compiler and the site are on different drives. I've looked EVERYWHERE on the web and can't seem to find a simple "Guide to Converting Perl for Unix scripts to Perl for Windows." Thanks for your reply and any other suggestions you might have, Elissa Joan
      Web page! Ah... this sounds like we may have CGI problems to consider.

      In the shebang line, you probably need to explicitly state the location of your Perl compiler, including the drive. Your Web server might find Perl if it's in your path, but I wouldn't be willing to place bets on it. On my local box (Win98, ActiveState, and Apache), I found that if I change my shebang line from #!C:/perl/bin/perl.exe -Tw to #!perl/bin/perl.exe -w, it still runs. However, C:/perl/bin is in my path, so that may have something to do with it.

      Don't worry about the slashes with Perl. Perl uses the forward slash as a path separator, despite Windows using the back slash. This allows for greater portability.

      What do you mean your script says "Done" at the bottom? That sounds to me like you are running it through a DOS window instead of a browser. If so, are you using the object-oriented style of CGI.pm (are you using CGI.pm)? If not, you can't pass name=value pairs through on the command line (used when you debug from the command line) which may possibly interfere with your script's execution (i.e. it can't process parameters that it doesn't receive). Another issue: sometimes CGI scripts are required to be run through a browser (they may be checking whether or not you've properly authenticated, for example). If so, you'll need to find where such issues arise and develop some debugging routines to deal with this.

      Incidentally, since it sounds like you are running it through a DOS window, I suspect you are invoking it with something like perl somescript.cgi. If so, you should be getting an error message saying Too late for "-T" option at somescript.cgi line 1. If not, you're not using taint checking. That's probably not going to stop your script from running, but it will be a huge security hole.

      Lastly: if you are running the script through the command line, I strongly suggest that you learn how to use the debugger. You may hate it now, but it will quickly become one of your best friends. If you learn to use it, you will probably find your problem immediately.

      Cheers,
      Ovid

        Thanks for the info about '/'s. But it seems to make a difference which I use. When I had '/'s, it gave a different error message, that it couldn't find a file. Does it make a difference if it uses " or '? I'm running it from the browser. It's supposed to pull up a very simple screen with a button, and it doesn't even do that. The code's not very well documented, or I would just skip the browser jaz and have it pretend that it just clicked the button and run it from the command line. -Elissa