[Catalyst-commits] r10679 - in Catalyst-Runtime/5.80/trunk: .
lib/Catalyst/Component
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Fri Jun 26 17:11:09 GMT 2009
Author: rafl
Date: 2009-06-26 17:11:08 +0000 (Fri, 26 Jun 2009)
New Revision: 10679
Added:
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component/ContextClosure.pm
Modified:
Catalyst-Runtime/5.80/trunk/Makefile.PL
Log:
Add Catalyst::Component::ContextClosure.
Modified: Catalyst-Runtime/5.80/trunk/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/trunk/Makefile.PL 2009-06-26 15:28:41 UTC (rev 10678)
+++ Catalyst-Runtime/5.80/trunk/Makefile.PL 2009-06-26 17:11:08 UTC (rev 10679)
@@ -5,6 +5,7 @@
name 'Catalyst-Runtime';
all_from 'lib/Catalyst/Runtime.pm';
+requires 'namespace::autoclean';
requires 'namespace::clean';
requires 'B::Hooks::EndOfScope' => '0.08';
requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801';
@@ -32,6 +33,7 @@
requires 'Tree::Simple' => '1.15';
requires 'Tree::Simple::Visitor::FindByPath';
requires 'URI' => '1.35';
+requires 'Task::Weaken';
requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
requires 'MRO::Compat';
requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
Added: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component/ContextClosure.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component/ContextClosure.pm (rev 0)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component/ContextClosure.pm 2009-06-26 17:11:08 UTC (rev 10679)
@@ -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;
More information about the Catalyst-commits
mailing list