|Just another Perl shrine|
CGI troubles for code that runs on both Windows and OpenSuse Linux 12,3by ted.byers (Monk)
|on Dec 20, 2013 at 06:08 UTC||Need Help??|
ted.byers has asked for the
wisdom of the Perl Monks concerning the following question:
I have two differences that are proving to be intransigent.
1) On Windows, I can set $!perl on the first line, and since perl is in the path, Windows finds it and executes the script. On linux, I have found the hard way that I have to use #!/usr/bin/perl. Otherwise, Linux refuses to execute the script. Obviously, this means I can not use a single set of files that will run on both Windows and Linux. Rather, I have to maintain two sets of files in which the ONLY difference is the #! line. Is there a way to work around this, so that identical code will run properly on both platforms; and that without taking a performance hit?
2) In my apache2 configuration, in my cgi-bin configuration, I have an AddHandler statement that associates perl-script with all files in cgi-bin with the .pl extension (and I did remember to restart apache after adding that AddHandler statement). On Windows, this was sufficent. Without it, on OpenSuse Linux, apache tells me that the file doesn't exist. But, with it, apache offers to open the file with kwrite, instead of executing it. I DID use chmod 700 to make the file executable (though I am not sure this is correct), following a couple pages I found using Google. NB: at this time, I am not using mod_perl (though that may change soon). This is on OpenSuse 12.3. What have I missed that results in the offer to open or download the script rather than having it executed?
NB: I am in the process of learning Linux after decades of working intensely on Windows, so please don't be too harsh if I missed something basic. ;-)