perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anthony Gardner <cyclewood_...@yahoo.co.uk>
Subject Re: CGI versus Apache::Request -- confusion
Date Thu, 31 Jan 2008 16:57:42 GMT
If you have a vanilla CGI script, every request you make to the webserver it's running on,
will always create a new instance of that script, run it, return the values in a response
and then the script ceases to exist in the server. The next time a request arrives for that
script, the same sequence of events will start all over again. This becomes time consuming
and a drag on the server's resources.

ModPerl::Registry, wraps your CGI script up as a handler, and allows the webserver to keep
the same CGI script alive in the webserver between requests. This cuts down an starting the
script up for every request. It's faster.

The request object is a structure that holds a lot of information, including params passed
in from the request. How to use this request object, I outlined in my first mail to you. But
the fact that it's available (should you need it) in your CGI script is because your CGI script
magically becomes a handler. The first argument to any handler is the request object.

I hope this helps.

-Ants

Mag Gam <magawake@gmail.com> wrote: But I am already reaping benefits of mod-perl. Not
sure how ModPerl:Registy is going to help. What is its main benefits? Is it speed?


On Jan 31, 2008 5:03 AM, Anthony Gardner <cyclewood_ltd@yahoo.co.uk> wrote:
 The request object is used in handlers. You can either write handlers or CGI scripts. Continue
using CGI but inorder to reap the benifits of mod-perl, you will need to run it under ModPerl::Registry.
  
 In your CGI script, while running under ModPerl::Registry., you even have access to the request
object.  If, at main::, you have my $r = shift;, then you will get the object.
 
 I hope this helps.
 
 -Ants 


Mag Gam <magawake@gmail.com> wrote:  Hi All,

I am  bit confused. While reading the mod_perl book, I noticed they are using Apache::Request
versus CGI for form data handling. Why is that? Is it recommended to use Apache over CGI?
Any advantages? I am using CGI because its a standard module.
  
TIA

 




Disclaimer: Technically, I'm always wrong!!
        
---------------------------------
 Sent from Yahoo! - a smarter inbox.
 

 


Disclaimer: Technically, I'm always wrong!!
       
---------------------------------
 Sent from Yahoo! &#45; a smarter inbox.
Mime
View raw message