Arshavir Grigorian wrote:
>     The same thing happens with Tamplate object. Most part of my scripts
> 
>     have to generate output over a Template Toolkit. So, may I declare the
>     Template object in the only place, and then use it into response
>     handlers ?
> 
> 
> You can create a Template object in your top handler, store it in  the
> request's pnotes ($r->pnotes), then retrieve it later in a different
> module when you are ready to use it.
> Hope that helps.

The same advice goes with any object you may or may not need during a request.
If you need it, check pnotes. If it's there use it, else create it and put it
back into pnotes.

But for the Template object, I would strongly suggest creating a package level
Template object in some base controller package or some other package. Create it
at compile time and then it will already exist for every request. This will also
improve caching since it can cache all of the templates in memory.

-- 
Michael Peters
Developer
Plus Three, LP

Reply via email to