|Practical mod_perl / HTML Book /|
220.127.116.11. Running scripts located in the same directory under different handlers
# 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.
mod_perl, modperl, Apache, perl, cgi, html, mod_perl, e-commerce, scalability, free, open source, OSS, apache, squid, high availability, modperl, linux, unix, Web, www, mod_perl, webserver, admin, apache, book, webmaster, tools, modperl, guide, docs, documentation, help, mod_perl, perl, information, apache, script, errata, eric cholet, perl, apache, mod-perl, stas bekman, mod_perl, cool, perl, Apache, performance, speed, choice
Other projects to check out: meta-religion.com is for those interested in Religious, Spiritual and Esoteric Phenomena. i-want-a-better.com is a community of people discussing what they would like to be improved in their lives and things they use and interact with. You may also want to find a healer in your area or read articles on variety of topics.