# Typical for plain cgi scripts: ScriptAlias /cgi-bin/ /home/httpd/perl/ # Typical for Apache::Registry scripts: Alias /perl/ /home/httpd/perl/ # Typical for Apache::PerlRun scripts: Alias /cgi-perl/ /home/httpd/perl/ <Location /perl/> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI </Location> <Location /cgi-perl/> SetHandler perl-script PerlHandler Apache::PerlRun Options +ExecCGI </Location>
the following three URIs:
http://www.example.com/perl/test.pl http://www.example.com/cgi-bin/test.pl http://www.example.com/cgi-perl/test.pl
are all mapped to the same file, /home/httpd/perl/test.pl. If test.pl is invoked with the URI prefix /perl, it will be executed under the Apache::Registry handler. If the prefix is /cgi-bin, it will be executed under mod_cgi, and if the prefix is /cgi-perl, it will be executed under the Apache::PerlRun handler.
This means that we can have all our CGI scripts located at the same place in the filesystem and call the script in any of three ways simply by changing one component of the URI (cgi-bin|perl|cgi-perl).
This technique makes it easy to migrate your scripts to mod_perl. If your script does not seem to work while running under mod_perl, in most cases you can easily call the script in straight mod_cgi mode or under Apache::PerlRun without making any script changes. Simply change the URL you use to invoke it.
Although in the configuration above we have configured all three Alias es to point to the same directory within our filesystem, you can of course have them point to different directories if you prefer.
This should just be a migration strategy, though. In general, it's a bad idea to run scripts in plain mod_cgi mode from a mod_perl-enabled server—the extra resource consumption is wasteful. It is better to run these on a plain Apache server.