diff options
author | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-11 21:08:20 +0000 |
---|---|---|
committer | groditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-11-11 21:08:20 +0000 |
commit | 747a1feb2d49d2dba85f997fa2f4542a17800331 (patch) | |
tree | bd1d5330d907dff7befe227f1bcdd20b7ef911ed /lib/Reaction/UI/Controller.pm | |
parent | 7ea45b2aff36dd61953b1517a1cfb079dcea230c (diff) | |
download | reaction-747a1feb2d49d2dba85f997fa2f4542a17800331.tar.gz reaction-747a1feb2d49d2dba85f997fa2f4542a17800331.zip |
fix leaks via make_context_closure
Diffstat (limited to 'lib/Reaction/UI/Controller.pm')
-rw-r--r-- | lib/Reaction/UI/Controller.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Reaction/UI/Controller.pm b/lib/Reaction/UI/Controller.pm index 76b562e..fc2f597 100644 --- a/lib/Reaction/UI/Controller.pm +++ b/lib/Reaction/UI/Controller.pm @@ -7,6 +7,7 @@ use base qw( ); use Reaction::Class; +use Scalar::Util 'weaken'; sub push_viewport { my $self = shift; @@ -73,6 +74,13 @@ sub redirect_to { $c->res->redirect($uri); } +sub make_context_closure { + my($self, $closure) = @_; + my $ctx = $self->context; + weaken $ctx; + return sub { $closure->($ctx, @_) }; +} + 1; __END__; |