Re: Advice needed on custom webapp framework
[prev]
[thread]
[next]
[Date index for 2004/11/17]
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
 |
 |
Re: Advice needed on custom webapp framework
Tom Schindl 18:25 on 17 Nov 2004
|