Any file that has the mime type application/x-httpd-cgi or handler cgi-script (Apache 1.1 or later) will be treated as a CGI script, and run by the server, with its output being returned to the client. Files acquire this type either by having a name containing an extension defined by the AddType directive, or by being in a ScriptAlias directory. Files that are not in a ScriptAlias directory, but which are of type application/x-httpd-cgi by virtue of an AddType directive, will still not be executed by the server unless Options ExecCGI is enabled. See the Options directive for more details.
When the server invokes a CGI script, it will add a variable called DOCUMENT_ROOT to the environment. This variable will contain the value of the DocumentRoot configuration variable.
Debugging CGI scripts has traditionally been difficult, mainly because it has not been possible to study the output (standard output and error) for scripts which are failing to run properly. These directives, included in Apache 1.2 and later, provide more detailed logging of errors when they occur.
1) Trailing slash on the path of <Directory> and DocumentRoot is a syntax error
but not strict enough to prompt you for error.
2) How did you configure mod_perl? Via URI or extension? You only have AddHandler cgi-script .cgi
and no .pl
. But the .pl were giving you the troubles.
3) Instead of CGI::Carp
you can use ScriptLog
to see more verbose errors.
4) Change the LogLevel
and see if there is any error code in your log.
5) If you composed your script in Windows, try to use a better editor (i.e. UltraEdit) than notepad/wordpad and trim all trailing space and convert to UNIX format on exit.