Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod_perl design concept questions

Status
Not open for further replies.

widdgetz

Technical User
Aug 31, 2003
35
0
0
US
I am designing a web site in Perl, and although I have worked with perl for several years, I have just started researching mod_perl 2.

Before mod_perl, a basic perl script used in this project could be abstracted as follows:
• Browser hits contribute.pl
• contribute.pl loads custom module Perl::Output
• contribute.pl loads CGI input from global $q = new CGI variable exported by Perl::Output
• contribute.pl appends all content to global $body variable exported by Perl::Output
• contribute.pl calls printHTML in Perl::Output which wraps $body in the page template and prints everything back to the browser

I am just not able to wrap my mind around the concept of Apache handlers - whether I need to write any and for what - and the scope of variables.

My script works under mod_perl, but unless I re-initialize the variables at the start of the script, the page is appended to the last $body output. I think, though, that there will only be one copy of $body for all requests and everything would get messed up.

Can someone enlighten me as to the proper way to do this sort of thing with mod_perl? It seems like Output.pl could be converted to a content handler but I am very confused about how everything ties together - how I would print the output from a script like contribute.pl using a modularized Output.pm...
 
You wouldn't be re-initialising, simply initialising ... good practice.
Code:
my $body="";

On the mod_perl design thing, best thing would be look for a few tutorials ...

HTH



Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top