Apache/Perl question

David Hummel dhml at comcast.net
Thu Aug 18 22:39:57 EDT 2005


On Thu, Aug 18, 2005 at 09:47:49PM -0400, nmeyers at javalinux.net wrote:
> 
> This isn't exactly what you're asking... but I recommend using
> mod_perl instead of putting Perl scripts in cgi-bin.

Yes, mod_perl is preferable, but let's not let Ronny be confused by this.
Configuration of mod_perl is separate from regular CGI.

> What you're trying to do is run scripts in external perl processes;
> mod_perl runs scripts in the Apache process.

To be more precise, there is still a perl interpreter, it's just
embedded in the Apache server process.  Each script is compiled into
memory as a perl routine.  This is only necessary on the first
execution, which is where the performance boost comes from.

> It doesn't change the scripts at all, but vastly improves performance.

Actually you do need to pay more attention to how scripts are written.
You must "use strict;" and pay close attention to scoping issues by
judicious use of "my/our/local", among other things.  If you do these
things, then yes it's possible to run scripts virtually unaltered,
thanks to Apache::Registry and friends.

-David



More information about the Discuss mailing list