help with rewriting CGI

2007-12-30 Thread Raful Mr Mitchell H
I have a site that is written with traditional CGI (no cgi.pm ).  I use 
mod_perl2 but rather than run the scripts as CGI I want to convert them to 
mod_perl.  I have read Beckman's latest on mod_perl 2 and have Practical 
Mod_Perl. 
 
Here's the question.  From what I have read, it looks like I should re-write my 
perl scripts as perl modules and make the appropriate changes, such as using $r 
inside handlers, etc.  Once complete, I can preload the modules at Apache 
startup.  Is that correct?  Also, I may want to use ajax, therefore, what 
modules will I need to run Apache2::Ajax?
 
Thanks,
 
Mitch

Mitchell Raful MCSE CCNP 
MCB Quantico 
Personal and Family Readiness (MRI) 
3044 Catlin Avenue 
Quantico, VA 22134 
Com: 703-784-5991 
DSN: 278-5991 
Cell: 804-363-0731 

 


Re: help with rewriting CGI

2007-12-30 Thread Boysenberry Payne
Once complete, I can preload the modules at Apache startup.  Is  
that correct?



If you want to benefit from pre compiling your code using something  
like a startup.pl file to load the modules

you use would speed things up considerably from running them as CGI cgi.

I use 2 files one for 3rd party modules and one for my own with it's  
own include path.


Also, I may want to use ajax, therefore, what modules will I need  
to run Apache2::Ajax?


Ajax is a client side technology.  You would use whatever you're  
using now, only
running your cgi as mod_perl scripts instead, e.g. if you use CGI.pm  
to process
ajax requests currently, you might want to look into the APR modules  
as replacements for

acquiring your request data.
http://httpd.apache.org/apreq/docs/libapreq2/modules.html

Also keep in mind using mod_perl over standard cgi scripts gives you  
a larger apache life cycle,
i.e. some scripts might be better off applied as filters rather than  
during the response phase.


http://perl.apache.org/docs/2.0/user/handlers/ 
http.html#PerlResponseHandler
http://perl.apache.org/docs/2.0/user/handlers/ 
filters.html#HTTP_Request_Versus_Connection_Filters


Hope that helps.

-bop

On Dec 30, 2007, at 9:10 AM, Raful Mr Mitchell H wrote:

I have a site that is written with traditional CGI (no cgi.pm ).  I  
use mod_perl2 but rather than run the scripts as CGI I want to  
convert them to mod_perl.  I have read Beckman's latest on mod_perl  
2 and have Practical Mod_Perl.


Here's the question.  From what I have read, it looks like I should  
re-write my perl scripts as perl modules and make the appropriate  
changes, such as using $r inside handlers, etc.  Once complete, I  
can preload the modules at Apache startup.  Is that correct?  Also,  
I may want to use ajax, therefore, what modules will I need to run  
Apache2::Ajax?


Thanks,

Mitch
Mitchell Raful MCSE CCNP
MCB Quantico
Personal and Family Readiness (MRI)
3044 Catlin Avenue
Quantico, VA 22134
Com: 703-784-5991
DSN: 278-5991
Cell: 804-363-0731