X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FView%2FComponent%2FSubInclude%2FVisit.pm;h=6bd96a5c6ac5b196e2a130344365e2eb9efce3dc;hb=e598e6a1abd71b44e23ab2f47f6ea3d28de05cbe;hp=034f058b10470c811b5025842bbfde9e1db79b16;hpb=f91a7d21c753463d37f02cf9642ca80ddf0dadc7;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 034f058..6bd96a5 100644 --- a/lib/Catalyst/View/Component/SubInclude/Visit.pm +++ b/lib/Catalyst/View/Component/SubInclude/Visit.pm @@ -1,9 +1,8 @@ package Catalyst::View::Component::SubInclude::Visit; -use warnings; -use strict; - +use Moose; use Carp qw/croak/; -use namespace::clean; +use MooseX::Types::Moose qw/ Bool /; +use namespace::clean -except => 'meta'; =head1 NAME @@ -11,11 +10,12 @@ Catalyst::View::Component::SubInclude::Visit - visit() plugin for C::V::Componen =head1 VERSION -Version 0.07 +Version 0.07_03 =cut -our $VERSION = '0.07'; +our $VERSION = '0.07_03'; +$VERSION = eval $VERSION; =head1 SYNOPSIS @@ -44,7 +44,7 @@ B. Apparently, C doesn't handle this type of actions yet. -=head1 CLASS METHODS +=head1 METHODS =head2 C @@ -58,14 +58,20 @@ with the other plugins. =cut +has keep_stash => ( + isa => Bool, + is => 'ro', + default => 0, +); + sub generate_subinclude { - my ($class, $c, $path, @params) = @_; + my ($self, $c, $path, @params) = @_; croak "subincludes through visit() require Catalyst version 5.71000 or newer" unless $c->can('visit'); { - local $c->{stash} = {}; + local $c->{stash} = $self->keep_stash ? $c->{stash} : {}; local $c->request->{parameters} = ref $params[-1] eq 'HASH' ? pop @params : {}; @@ -104,4 +110,5 @@ under the same terms as Perl itself. =cut +__PACKAGE__->meta->make_immutable; 1;