logo       

Global "app context" approach: msg#00183

web.mason.user

Subject: Global "app context" approach

Hi all,

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?

Currently I'm grabbing these through $HTML::Mason::Commands::LOG, for example,
but I'm a touch uneasy with that, I believe I've seen "not advised" warnings
around here.

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.

So in short - is there a common pattern for providing a global app context to
all components and modules? (Realizing this is running in processes and not a
never-ending persistent app server)

Thanks in advance,
TG

--

___________________________
toddgrimason*todd@xxxxxxxxx




-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0


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

News | FAQ | advertise