* Mark Stosberg <[EMAIL PROTECTED]> [2008-06-21T10:53:56]
> $t->param( c => $self ) if $var =~ /^c\./;
>
> Is it correct that it should actually be this?
>
> use Scalar::Util 'weaken';
> $t->param( c => weaken($self) ) if $var =~ /^c\./;
No. Scalar::Util weakens the actual reference. It does not return a new, weak
reference.
What you're doing is this:
$t->param(c => $self);
weaken $self;
The $self in the template stash is a strong reference, and the object itself is
weak. I'm not sure of the scope of $t, here, but were $t to go out of scope,
taking its params with it, and if there were no other references to the object,
$self would become undef.
What you want is something like:
$t->param(c => $self);
weaken $t->param('c');
I suggest testing my assertions with Scalar::Util::isweak.
--
rjbs
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################