X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FComponent%2FSubInclude%2FVisit.pm;h=7ffae03cc9a237b2bd924849f2e9a779c753e5a9;hb=8bbd65bf6b13d05aae77781463bc43f3c0a44deb;hp=c82fe731e744fc10c2ddbe56cbe970632d23882e;hpb=be2a019af2b1ffb2672e77b65e3644ee6ee278cd;p=catagits%2FCatalyst-View-Component-SubInclude.git diff --git a/lib/Catalyst/View/Component/SubInclude/Visit.pm b/lib/Catalyst/View/Component/SubInclude/Visit.pm index c82fe73..7ffae03 100644 --- a/lib/Catalyst/View/Component/SubInclude/Visit.pm +++ b/lib/Catalyst/View/Component/SubInclude/Visit.pm @@ -1,9 +1,7 @@ package Catalyst::View::Component::SubInclude::Visit; -use warnings; -use strict; - +use Moose; use Carp qw/croak/; -use namespace::clean qw/croak/; +use namespace::clean -except => 'meta'; =head1 NAME @@ -11,11 +9,11 @@ Catalyst::View::Component::SubInclude::Visit - visit() plugin for C::V::Componen =head1 VERSION -Version 0.03 +Version 0.07 =cut -our $VERSION = '0.03'; +our $VERSION = '0.07'; =head1 SYNOPSIS @@ -59,22 +57,21 @@ with the other plugins. =cut sub generate_subinclude { - my ($class, $c, $path, @params) = @_; + my ($class, $config, $c, $path, @params) = @_; croak "subincludes through visit() require Catalyst version 5.71000 or newer" unless $c->can('visit'); - - $c->log->debug("generate subinclude: $path @params"); { - local $c->{stash} = {}; + local $c->{stash} = $config->{keep_stash} ? $c->{stash} : {}; local $c->request->{parameters} = ref $params[-1] eq 'HASH' ? pop @params : {}; local $c->response->{body}; - $c->visit( $path, ( ref $params[0] eq 'ARRAY' ? shift @params : () ) ); + my $captures = ref $params[0] eq 'ARRAY' ? shift @params : []; + $c->visit( $path, $captures, \@params ); return $c->response->{body}; } @@ -105,4 +102,5 @@ under the same terms as Perl itself. =cut +__PACKAGE__->meta->make_immutable; 1;