Introduce a way to pass config down into the plugins
[catagits/Catalyst-View-Component-SubInclude.git] / lib / Catalyst / View / Component / SubInclude / Visit.pm
index 034f058..d5c5ec0 100644 (file)
@@ -59,13 +59,13 @@ 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');
 
     {
-        local $c->{stash} = {};
+        local $c->{stash} = $config->{keep_stash} ? $c->{stash} : {};
         
         local $c->request->{parameters} = 
             ref $params[-1] eq 'HASH' ? pop @params : {};