From: Tomas Doran Date: Sun, 24 Jan 2010 21:42:19 +0000 (+0000) Subject: Switch to using contextclosure X-Git-Tag: 0.07_01~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-View-Component-SubInclude.git;a=commitdiff_plain;h=d547aa9523060fbe40d76cfd935e19c296def29e Switch to using contextclosure --- diff --git a/lib/Catalyst/View/Component/SubInclude.pm b/lib/Catalyst/View/Component/SubInclude.pm index 0585a4c..ba2c397 100644 --- a/lib/Catalyst/View/Component/SubInclude.pm +++ b/lib/Catalyst/View/Component/SubInclude.pm @@ -2,9 +2,10 @@ package Catalyst::View::Component::SubInclude; use Moose::Role; use Carp qw/croak/; -use Scalar::Util qw/weaken/; use namespace::clean -except => 'meta'; +with 'Catalyst::Component::ContextClosure'; + =head1 NAME Catalyst::View::Component::SubInclude - Use subincludes in your Catalyst views @@ -122,11 +123,9 @@ around 'new' => sub { before 'render' => sub { my ($self, $c, @args) = @_; - - weaken $c; - $c->stash->{subinclude} = sub { $self->_subinclude( $c, @_ ) }; - $c->stash->{subinclude_using} = sub { $self->_subinclude_using( $c, @_ ) }; + $c->stash->{subinclude} = $self->make_context_closure(sub { $self->_subinclude( @_ ) }, $c); + $c->stash->{subinclude_using} = $self->make_context_closure(sub { $self->_subinclude_using( @_ ) }, $c); }; sub set_subinclude_plugin {