Perrin Harkins wrote:
There are tutorials on the Template Toolkit site, a recent perl.com
article about TT and Class::DBI, and my article:
http://perl.apache.org/docs/tutorials/apps/scale_etoys/etoys.html

I read Perrin's case study awhile ago and it was excellent. Out of curiosity (and since most of my code written prior to reading said article looks identical in structure) where did you (Perrin) keep objects like your database handle (assuming DBI, but please correct otherwise) and any objects that could be reused (TT, XML parser objects, et al)?


I see a reference to a utility style class (ESR::Util, IIRC), but after rereading a number of articles and design pattern books, I'm reluctant to go with a "handle holder" object as I've done in the past. I use a configuration object that parses and holds all site config info (DBI dsn, user, pass, TT paths, etc.), when apache starts - a singleton style class. What I'd like is to have my model (as in MVC) objects reuse the process or maybe even server shared objects without doing any of these:

1. Using a singleton utility class
2. Needing to pass objects to model objects' new() in teh controllers
3. Instantiating the objects in the model classes themselves

I guess I could use a class to just act as a namespace to hold the objects and create them at server startup time and use a module like IPC::MM, File::Cache, or Cache::Mmap but that feels kludgy and offers no encapsulation for the objects themselves.

I'm sure I'm either overcomplicating the situation to some great extentent or the utility class is the way to go (combined with some caching / shared mem module). Is there some obvious pattern I've missed or should I just KISS?

Perrin - Have you ever considered revealing more about the Etoys project or just the concepts as you applied them? It would be nice to peek at some of the details. Or, is this an NDA situation or some such thing? Either way, great article.

Thanks in advance.
--
Eric Sammer
[EMAIL PROTECTED]
http://www.ineoconcepts.com



Reply via email to