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

Hi could anyone help me with using Cygwin and running Perl scripts, especially CGI one's because I only got Cygwin so that I could run them. I've looked through some o the posts on here about Cygwin use and I've looked at their manual aswell, yet neither have helped me with my problem. I'm running Windows 8 on my laptop and when using Notepad++ and the Perl Command line, I can run perl scripts, but not CGI scripts with perl in them. What I've been able to understand so far is that directories as different in Cygwin because it uses Unix syntax. I've also seen some people suggesting to change the shebang on the file I am trying to run to something else in order to point the interpreter the one installed by Cygwin. I am using STRAWBERRY PERL aswell. Maybe this is a problem, I don't know because everyone else I see is using ActiveState with Cygwin. Please help because I am very frustrated and just want to continue on with programming. Would uninstalling Strawberry Perl and just having Cygwin Perl help/fix the problem?

Replies are listed 'Best First'.
Re: Running Perl CGI scripts with Cygwin
by dasgar (Priest) on Oct 08, 2013 at 03:49 UTC

    As someone else has pointed out, you don't necessarily need Cygwin to develop and test Perl-based CGI code. A simple way to test your CGI code would be to use web framework modules like Dancer or Mojolicious to act as the web server for the CGI script. That would be good for the user interface part. However, it would be quite a bit different than an actual webserver as far as some back end stuff (such as user permissions to access local filesystem and utilities).

    Just one note. It almost sounded like you installed Cygwin on a whim, hoping it would provide what you needed/wanted. Unless they have improved things, you might find a new nightmare if you ever decide that you don't want Cygwin anymore. The last time that I ever tried to uninstall Cygwin (which was several years ago), I never could get it to fully uninstall cleanly. The only way that I found to fully remove Cygwin was to reinstall the OS. I'm not saying that Cygwin is a bad thing to use. Just wanted to give you a heads up in case you decide that you want to remove Cygwin.

Re: Running Perl CGI scripts with Cygwin (no cygwin)
by Anonymous Monk on Oct 08, 2013 at 02:25 UTC

      The problem is I tried using Apache to do this to make a local web server (localhost). The server works fine with PHP but when I try and put the cgi perl files into the cgi-bin, I can't figure out how to run them because the /localhost directory that pops up when I enter localhost doesnt include files from the cgi-bin that are available to run.

        because the /localhost directory that pops up when I enter localhost doesnt include files from the cgi-bin that are available to run

        It doesn't work that way. The contents of cgi-bin directory is not supposed to be displayed. You have to know what to ask the web server for, when you want to run a cgi programme.

        Cheers, Sören

        Créateur des bugs mobiles - let loose once, run everywhere.
        (hooked on the Perl Programming language)

        The problem ...

        And then what happened? Read the links, find your answer, or something else, bye