You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jonathan Vanasco <jv...@mastersofbranding.com> on 2005/02/09 17:26:09 UTC
feedback on an approach
could someone who has worked w/mod perl longer than I have give me some
feedback on this approach to webapps i've been using lately:
• the modperl handler creates a 'user' of the web app based on the
apache request
the 'user' handles all the session management, login, etc
my $user = new myApp::User( $r );
• the handler then creates a 'page' of the webapp as such
my $page = new myApp::Page( $user );
then calls it to render
my $outputHTML = $page->render()
the myApp::Page is a perl mod that pulls the request info off of the
user object, and correlates that to the user profile
everything is a perlmod that is pre-compiled. subclasses of
myApp::Page are the page content areas
It sounds crazy, and probably is.
playing around for a while, i realized that the dynamic stuff of the
pages for what i'm doing are 90% served out of a DB , repeatedly
called, and everything in terms of templating/standardizing really
inherits its design from the parent sections (perhaps its too oop
bringing it into visual layout too?).
i'd imagine that i'd get a decent performance gain by just doing all
of this as a perlmod that is preloaded at startup -- which is kind of
like what I've done with python webapps under the twisted framework
before.
Re: feedback on an approach
Posted by Perrin Harkins <pe...@elem.com>.
On Wed, 2005-02-09 at 11:26 -0500, Jonathan Vanasco wrote:
> could someone who has worked w/mod perl longer than I have give me some
> feedback on this approach to webapps i've been using lately:
>
> • the modperl handler creates a 'user' of the web app based on the
> apache request
> the 'user' handles all the session management, login, etc
> my $user = new myApp::User( $r );
> • the handler then creates a 'page' of the webapp as such
> my $page = new myApp::Page( $user );
> then calls it to render
> my $outputHTML = $page->render()
>
> the myApp::Page is a perl mod that pulls the request info off of the
> user object, and correlates that to the user profile
>
> everything is a perlmod that is pre-compiled. subclasses of
> myApp::Page are the page content areas
>
> It sounds crazy, and probably is.
It's impossible to say, based on such a short description. What I can
say is that using a design like MVC that separates the presentation from
the functionality is pretty useful, and I often use inheritance in
controllers. I also use inheritance in presentation, usually by taking
advantage of whatever include path features the templating system I'm
using supports.
- Perrin