X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FComponent%2FSubInclude.pm;h=ba2c397da3e38b2e4b2afb9f4a05ba4a02be5812;hb=d547aa9523060fbe40d76cfd935e19c296def29e;hp=20909a6afe0901946be7b3054dee6e6a788dc5ff;hpb=be2a019af2b1ffb2672e77b65e3644ee6ee278cd;p=catagits%2FCatalyst-View-Component-SubInclude.git diff --git a/lib/Catalyst/View/Component/SubInclude.pm b/lib/Catalyst/View/Component/SubInclude.pm index 20909a6..ba2c397 100644 --- a/lib/Catalyst/View/Component/SubInclude.pm +++ b/lib/Catalyst/View/Component/SubInclude.pm @@ -2,7 +2,9 @@ package Catalyst::View::Component::SubInclude; use Moose::Role; use Carp qw/croak/; -use namespace::clean qw/croak/; +use namespace::clean -except => 'meta'; + +with 'Catalyst::Component::ContextClosure'; =head1 NAME @@ -10,11 +12,11 @@ Catalyst::View::Component::SubInclude - Use subincludes in your Catalyst views =head1 VERSION -Version 0.03 +Version 0.07 =cut -our $VERSION = '0.03'; +our $VERSION = '0.07'; =head1 SYNOPSIS @@ -104,7 +106,7 @@ in runtime. It expects a fully qualified class name. has 'subinclude_plugin' => ( is => 'rw', - isa => 'ClassName' + isa => 'Str' ); around 'new' => sub { @@ -119,14 +121,11 @@ around 'new' => sub { $self; }; -around 'render' => sub { - my $next = shift; +before 'render' => sub { my ($self, $c, @args) = @_; - - $c->stash->{subinclude} = sub { $self->_subinclude( $c, @_ ) }; - $c->stash->{subinclude_using} = sub { $self->_subinclude_using( $c, @_ ) }; - $self->$next( $c, @args ); + $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 {