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...
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...