perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew O'Brien" <andr...@oriel.com.au>
Subject RE: Is there a point in using the request object for db connections whenusing Apache::DBI?
Date Wed, 14 Jul 2004 06:49:07 GMT

> From: John P. Gibbons [mailto:john@dashing.com] 
> Subject: Is there a point in using the request object for db 
> connections when using Apache::DBI?

Hi John,

(note - I use HTML::Embperl extensively and exclusively so my ideas
 may be slanted somewhat)

> I was reading this article: 
> http://www.perl.com/pub/a/2001/03/embperl.html and of course this 
> mailing list and have seen reference to people using the $req 
> object to 
> have one database connection.
> 
> On my sites I did not do it that way. I use Apache::DBI to handle the 
> DBI connection issue and do a separate connects  in my 
> base.html and in 
> all other referenced Embperl files/code. Apache::DBI of course makes 
> sure we really only have one connection per httpd, as you all know.

I've generally found that for large application sites that involve a
large amount of common backend code with (possibly) many database
handles then the best way of dealing with it is to do as you have done
and let Apache::DBI take care of caching the (possibly) large number
of different database handles that are used throughout the perl
modules that generally fall out of such a setup. *Gasp*

Most of the modules that I write for such applications inherit from a
common base database class (think home grown Class::DBI) and have
intrinsic class-based handle sharing but its all the same idea.

None of the website code cares about database details whatsoever.
Abstraction and website code simplification are your friends. Well,
abstraction and efficient caching and code simplification. And ... :)

> I was wondering if there is any benefit or reason to use the request 
> object method in my scenario? I'm looking at ways to optimize 
> my code as 
> it has grown dramatically and this has been in the back of my 
> mind for 
> awhile. I remember reading something that in order to give db 
> access to 
> an include embperl file with only subroutines you'd have to use that 
> method. But I can't recall now. I was also thinking that 
> there are cases 
> when I call .epl files directly and do not want them wrapped in 
> base.html. If I were to use the request object method then I would 
> either be out of luck or would have to code around it somehow.

Using perl modules for the majority of data manipulation sidesteps this
kind of issue neatly.

> What's more, is this the appropriate place for these sorts of 
> questions?

AFAIK

> I have an interest in discussing Embperl with other 
> developers who are 
> actually making websites and learning about how they did things, etc. 

I certainly have a set of approaches that I've found useful over the
years that I'd be happy to share.

> All I usually see on the list are tech support related 
> discussions. If 
> this is the wrong place for that, is there another list or site that 
> might be better? If not would it be at all interesting if someone 
> started one? I'd be open minded to that as a side project. I already 
> have a complete content management system and community (with forums, 
> user profiles, etc) all written in Embperl. So I could do it 
> in short order.

There was talk of setting up something like this not-quite-so-recently.
Gerald has adapted several posts into HOWTO's and the like but I can't
recall a specific site.

I'd certainly be interested.

Cheers,

Andrew

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message