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

Hi
I'm running on Mac Os X and have configured my machine as a server. I edited one of my scripts a while ago using pico and now I get a 500 Internal Error. The error log contains -

Wed Dec 03 22:30:00 2008 error client ::1
(13)Permission denied: exec of '/Library/WebServer/CGI-Executables/test.pl' failed
Wed Dec 03 22:30:00 2008 error client ::1 Premature
end of script headers: test.pl

Is there a simple perl regex I can run on the command line to ensure that my script is indeed suitable for unix. Thanks!

Replies are listed 'Best First'.
Re: Dos Mode Script to Unix
by Fletch (Bishop) on Dec 03, 2008 at 22:32 UTC
Re: Dos Mode Script to Unix
by graff (Chancellor) on Dec 04, 2008 at 02:29 UTC
    How is the "Dos Mode" part of your title relate to the problem? If the perl script was copied from a dos machine, then a CRLF at the end of the shebang line might be the cause. But if it was created on linux, macosx or other unix system, it's not a CRLF problem, and just using pico to edit it shouldn't create a CRLF problem.

    The "Permission denied" thing is probably the best indicator -- check file modes and ownership, make sure the web server process has appropriate permissions on the file (read and execute). It could be that your particular usage with pico (or some other step) set the permissions the wrong way.

      Magic shebang :)
      #!/usr/bin/perl -w --