On Sun, 18 Aug 2002, Jonathan Lonsdale wrote:

> Date: Sun, 18 Aug 2002 00:31:03 +0100
> From: Jonathan Lonsdale <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Mod_perl Application Development
>
> I'm curious to know how people approach application development with
> mod_perl in situations where there could be dozens of distinct
> screens/interfaces. I'm currently using the HTML::Template system.
>
> Here's a few approaches I thought of:
>
> 1. Single monolithic content handler. Could be hard to maintain.
> 2. Distinct content handlers each with their own Location directive. Could
> be a pain to maintain the server config.

I've usually done #2, and it is a pain.  When you're developing and
making up just one <Location> at a time, it's not so bad, but when you
go to distribute the application and you see that someone will have to
set up 10 or so or them, then it looks a little hacky.

I've considered going to #1 and using CGI arguments (e.g.,
"page=foo") or path_info (e.g., "/my_handler/foo") to dispatch to the
correct module.  I certainly wouldn't advise that the logic for all
these <Location>s be in one module.

> 3. Take a small performance hit and use an Apache::Registry script for each
> screen to handle the content phase. Use 'PerlSetupEnv Off', $r and Apache::
> modules and don't bother being backwardly compatible with CGI.

There's nothing wrong with this or just about any other way you can
think as long as it works properly for you.  I'm currently looking at
the new Apache::TT2 module (http://apache-tt2.sourceforge.net/) as a
way of getting rid of all <Location> directives.  The templates are
called in the same manner as HTML pages (i.e., by specifying a URL)
and Apache::TT2 processes the pages as it normally would, allowing you
to call out to objects and libraries and such.

The exhaustive list of how other people are doing this would be
difficult to compile and voluminous.  I'd recommend you also look into
all the other very fine application frameworks, like HTML::Mason,
CGI::Application, Apache::PageKit and others.

ky

Reply via email to