No need for an around modifier, can quite happily be a before
[catagits/Catalyst-View-Component-SubInclude.git] / lib / Catalyst / View / Component / SubInclude.pm
index e4505e0..0585a4c 100644 (file)
@@ -2,7 +2,8 @@ package Catalyst::View::Component::SubInclude;
 use Moose::Role;
 
 use Carp qw/croak/;
-use namespace::clean qw/croak/;
+use Scalar::Util qw/weaken/;
+use namespace::clean -except => 'meta';
 
 =head1 NAME
 
@@ -10,11 +11,11 @@ Catalyst::View::Component::SubInclude - Use subincludes in your Catalyst views
 
 =head1 VERSION
 
-Version 0.05
+Version 0.07
 
 =cut
 
-our $VERSION = '0.05';
+our $VERSION = '0.07';
 
 =head1 SYNOPSIS
 
@@ -119,14 +120,13 @@ around 'new' => sub {
     $self;
 };
 
-around 'render' => sub {
-    my $next = shift;
+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, @_ ) };
-
-    $self->$next( $c, @args );
 };
 
 sub set_subinclude_plugin {