I've knowledge about establishing multiple Perl program with mac before, but arrived at an unusual situation today.

I remove among my existing Perl folder and download it from GitHub, after i attempt to run again, it shows this error: [a mistake happened while processing this directive].

So, things i do in order to debug is:

1) I create test.shtml (some problem exhibiting the arrow register here)

#exec cgi="/Users/lion/htdocs/app/cgi-bin/test.pl"-->

2) I create test.pl

#!/usr/bin/perl
print "content-type: text/html \n\n";
print "test";

3) I produce a new htaccess

AddType text/html .shtml
AddHandler server-parsed .shtml

4) I set the exam.pl permission to 777

5) I examined with http://app.local/test.shtml -> emerge error [a mistake happened while processing this directive].

6) Basically by hand run from console, it's working fine.

Here's my apache config too.

<VirtualHost *:80>
    DocumentRoot "/Users/lion/htdocs/app"
    ServerName app.local
    ScriptAlias /cgi-bin/ "/Users/lion/htdocs/app/cgi-bin/" 
</VirtualHost>

My apache error log show this:

[Wed Nov 09 16:45:25 2011] [error] [client 127.0.0.1] invalid CGI ref "/Users/lion/htdocs/app/cgi-bin/test.pl" in /Users/lion/htdocs/app/test.shtml

Unsure things i skipped out, my other Perl program is running all right. Exhaust ideas what make the problem.

exec cgi expects a URL-path, not really a file system path being an argument.

Try

#exec cgi="/cgi-bin/test.pl"

or simply

#exec cgi="test.pl"

Well, after investing sometime for debugging, discovered the reason is really a .htaccess with authentication in cgi-bin, it blocks the redirection.