>>>>> "dc" == darren chamberlain <[EMAIL PROTECTED]> writes:
dc> Vivek Khera ([EMAIL PROTECTED]) said something to this effect on 02/06/2001:
>> However, at the end of the template processing, the object is not
>> destroyed; that is, the DESTROY() method is never called, and
dc> You aren't clear about the scope of $tt; it sounds like a package
dc> level global, if it's being destroyed when the children exit.
$tt is intended to be persistent. TemplateToolkit cleans up its own
"stash" of objects after processing a template, but in mod_perl, the
stash objects seems to persist, even though they are inaccessible from
that stash.
I guess I need more explanation for mod_perl folks than I did for TT
folks.
Here's what happens.
$tt is the template toolkit object.
I call $tt->process($filename,$vars,$r) to process and output the page
to the web client.
During the process method, Template Toolkit creates a localized
"stash" of template variables. One of those variables is a 'session'
object I made. It is created like this: "[% USE s = session %]".
Now, when process() is done, it clears out the localized stash. In a
regular perl program, this causes the "s" object to be destroyed, and
the DESTROY method called. In mod_perl, the object is not destroyed
nor is the DESTROY method called until the httpd exits.