logo       

Re: Global "app context" approach: msg#00229

web.mason.user

Subject: Re: Global "app context" approach

On Sat, 23 Aug 2003, Todd Grimason wrote:

> I'm seeking a bit of advice on the best way to approach this before
> embarking down the wrong path...
>
> Basically what I'm looking to do is have a global "context", that has
> references to objects such as a logger, a config object, and similar.
>
> Is the Mason request object (I'm using ..WithApacheSession) the place to
> stick these, perhaps by wrapping/subclassing the request object?

I wouldn't recommend this approach.

What's wrong with something like:

MyApp::Context->log->...

The logging object can be created at server startup, or just the first itm
the log() method is called.

> I'd also like access to these object from perl modules - I suppose
> passing a context object to constructors would provide this. Another
> touch I'd like is to be able to check modification times on an external
> config file, to allow reloading without bouncing apache.

Or just make the context module's methods class methods, as above.


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise