X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FComponent%2FContextClosure.pm;fp=lib%2FCatalyst%2FComponent%2FContextClosure.pm;h=0aaf8bf3a7ae278b82ed9f4c22ca6092fa7c64c7;hb=5ad8be8c2865ed519105c506c721114e8e48fc75;hp=0000000000000000000000000000000000000000;hpb=f87b7c218042591dace942198aed7939f1782dfb;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Component/ContextClosure.pm b/lib/Catalyst/Component/ContextClosure.pm new file mode 100644 index 0000000..0aaf8bf --- /dev/null +++ b/lib/Catalyst/Component/ContextClosure.pm @@ -0,0 +1,14 @@ +package Catalyst::Component::ContextClosure; + +use Moose::Role; +use Scalar::Util 'weaken'; +use namespace::autoclean; + +sub make_context_closure { + my ($self, $closure, $ctx) = @_; + my $weak_ctx = $ctx; + weaken $ctx; + return sub { $closure->($ctx, @_) }; +} + +1;