Re: Advice needed on custom webapp framework

[prev] [thread] [next] [Date index for 2004/11/17]

From: Tom Schindl
Subject: Re: Advice needed on custom webapp framework
Date: 18:25 on 17 Nov 2004
jonathan vanasco wrote:

>
> I built for mod_perl1 a customer webapp framework
>
> It functions as 2 perl modules/package sets
>
> /lib/WebAppFramework
> /lib/Website
>
> For each website/webapp, i make a new /lib/Website that subclasses the 
> WebAppFramework (which handles users, email, webpage generation, etc 
> -- and makes heavy use of cpan modules -- i just wanted a way to find 
> a lowest-common-denominator to interface with multiple packages, so i 
> can rapidly prototype webapps)
>
> It worked really well for everything I want it to do -- super simple 
> and easy to build and add functions.
>
> except - its a little messy
>
> The idea I wanted to implement, is essentially this handler:
>
> my  $DB = new Website::DB();
> sub handler {
>     DEBUG >0 && print STDERR "============================ NEW 
> REQUEST\n\n";
>     my     $r         = shift;
>     my     $user     = new Website::User( \$r, \$DB );
>      my     $page     = new Website::Page( \$user , \$DB );
>     my     $html     = $page->processRequest();
>     $r->content_type('text/html');
>     $r->print( $html );
>     return OK;
> }
>
I don't answer your questions but why are you passing all objects by 
reference. An object is already a reference (normally Hash or Scalar)
and it does not improve your memory usage it only decreases your 
performance because you always have to dereference it.

> The idea, is that any page is just a view to a user (logged in or 
> not), so is rendered to that person.
>
> Now, this is my issue -- I'm creating a user AND a page with a ref to 
> the DB handle - which is wasteful. And requires a lot of extra typing 
> on my part.
>
> Ideally, I would have the packages  in Website and WebAppFramework 
> lookup the right DB for the Website
>
> I can't figure out how to do this in a coherent way though.
>
> Any  advice would be excellent.
>
>


        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Advice needed on custom webapp framework
jonathan vanasco 14:15 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Michael Schout 17:11 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Jonathan Vanasco 18:07 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Tom Schindl 19:26 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Jonathan Vanasco 19:32 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Tom Schindl 18:25 on 17 Nov 2004

Re: Advice needed on custom webapp framework
Jonathan Vanasco 18:39 on 17 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52