From: Luke Saunders Date: Wed, 25 Aug 2010 09:00:42 +0000 (+0000) Subject: weaken ctx to avoid leakage X-Git-Tag: v0.35~2^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4a70bc59c6a5b3f03de146d477cfacb4d600280e;hp=46cdc47d1c4ef7b18572019b9b904d84f6e45584;p=catagits%2FCatalyst-View-TT.git weaken ctx to avoid leakage --- diff --git a/lib/Catalyst/View/TT.pm b/lib/Catalyst/View/TT.pm index eebe59a..903facb 100644 --- a/lib/Catalyst/View/TT.pm +++ b/lib/Catalyst/View/TT.pm @@ -8,7 +8,7 @@ use Data::Dump 'dump'; use Template; use Template::Timer; use MRO::Compat; -use Scalar::Util qw/blessed/; +use Scalar::Util qw/blessed weaken/; our $VERSION = '0.34'; @@ -283,8 +283,10 @@ sub template_vars { Catalyst::Exception->throw( "$method_name not found in TT view" ); } my $method_body = $method->body; + my $weak_ctx = $c; + weaken $weak_ctx; my $sub = sub { - $self->$method_body($c, @_); + $self->$method_body($weak_ctx, @_); }; $vars{$method_name} = $sub; }