You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Rich Lemanski <rl...@siue.edu> on 2000/06/07 17:44:52 UTC

Newbie Questions about Perl/Apache

Hello all,

I just joined the list the other day and have some questions about
internal and external Perl interpretors for Apache.  Forgive my lack of
knowledge, but I am assuming that mod_perl is the Perl interpretor that
runs internally to Apache and starts when Apache starts.  The external
Perl interpretor option, Perl CGI, is run externally and must be spawned
by Apache anytime they are needed.  

Do I have the right idea?

Which would be better to go with from a performance standpoint?  I am
assuming mod_perl because the instance does not need to be respawned
everytime the interpretor is needed.  Thanks!

Rich


Re: Newbie Questions about Perl/Apache

Posted by Matt Sergeant <ma...@sergeant.org>.
On Wed, 7 Jun 2000, Rich Lemanski wrote:

> Hello all,
> 
> I just joined the list the other day and have some questions about
> internal and external Perl interpretors for Apache.  Forgive my lack of
> knowledge, but I am assuming that mod_perl is the Perl interpretor that
> runs internally to Apache and starts when Apache starts.  The external
> Perl interpretor option, Perl CGI, is run externally and must be spawned
> by Apache anytime they are needed.  
> 
> Do I have the right idea?

Almost, but not quite. Perl launched as a CGI only has access to
environment variables and STDIN (in the case of POST requests) it has no
access to any of the server's API. CGI is a cross-web server platform
concept.

mod_perl on the other hand is a complete implementation of the Apache API
in Perl. This means that you get full access to every C API that Apache
defines, and all the internals of Apache, if you want them. There are a
lot of modules which build on this capability, one of these is
Apache::Registry, which emulates a CGI-like environment in mod_perl, and
provides huge performance boosts over normal CGI. But to get the full
benefit of mod_perl it's often better to get right down into the Apache
API and write server modules to do your work, just as is the case that if
you need to improve a C based CGI, you will probably end up re-writing it
as a server module.

> Which would be better to go with from a performance standpoint?  I am
> assuming mod_perl because the instance does not need to be respawned
> everytime the interpretor is needed.  Thanks!

Yes, mod_perl is faster than CGI. There are a few "gotcha's", but these
are well documented in the guide at http://perl.apache.org/guide/

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org http://xml.sergeant.org