package Catalyst::View::Component::SubInclude::SubRequest;
-use warnings;
-use strict;
-
+use Moose;
use Carp qw/croak/;
-use Scalar::Util qw/blessed/;
-use namespace::clean;
+use MooseX::Types::Moose qw/ Bool /;
+use namespace::clean -except => 'meta';
=head1 NAME
=head1 VERSION
-Version 0.07
+Version 0.07_03
=cut
-our $VERSION = '0.07';
+our $VERSION = '0.07_03';
+$VERSION = eval $VERSION;
=head1 SYNOPSIS
It requires L<Catalyst::Plugin::SubRequest>.
-=head1 CLASS METHODS
+=head1 METHODS
=head2 C<generate_subinclude( $c, $path, @args )>
=cut
+has keep_stash => (
+ isa => Bool,
+ is => 'ro',
+ default => 0,
+);
+
sub generate_subinclude {
- my ($class, $c, $path, @params) = @_;
- my $stash = {};
+ my ($self, $c, $path, @params) = @_;
+ my $stash = $self->keep_stash ? $c->stash : {};
croak "subincludes through subrequests require Catalyst::Plugin::SubRequest"
unless $c->can('sub_request');
=cut
+__PACKAGE__->meta->make_immutable;
1;