On 7/21/05, Todd W <[EMAIL PROTECTED]> wrote:
> I do something like this, but I run my CGI::App driver under
> Apache::Registry, so I had to:
> 
> sub cgiapp_postrun {
>   my $self = shift;
>   $self->tt_params( c => undef ); # remove circular reference
> }
> 
> To get the reference count of $self's referent to 0. The circular reference
> manifested itself in my code by not flushing the session after a request.

Interesting.  What is happening is that tt_params ends up storing its
parameters in $self->{__TT_PARAMS}, so if you call $self->tt_params( c
=> $self ), then you end up with $self->{__TT_PARAMS}->{c} = $self. 
Hence your circular reference.

You can avoid the problem by using tt_pre_process (like in my example)
instead of tt_params.  The end result would be the same.

Maybe I'll add a notice in the docs for CGI::Application::Plugin::TT
to warn about that.

Cheers,

Cees

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to