view's configuration options (either in the config file or in the view module
itself).
-Configuration file example:
+ __PACKAGE__->config(
+ subinclude_plugin => 'ESI',
+ subinclude => {
+ 'SubRequest' => {
+ keep_stash => 1,
+ },
+ 'HTTP::POST' => {
+ class => 'HTTP',
+ http_method => 'POST',
+ ua_timeout => '10',
+ uri_map => {
+ '/foo/' => 'http://www.foo.com/',
+ },
+ },
+ },
+ );
- <View::TT>
- subinclude_plugin ESI
- </View::TT>
+You can change each plugins' configuration through the keys in the 'subinclude'
+config key (example above)
=head2 C<set_subinclude_plugin( $plugin )>
$c->sub_request( $translated_path, {}, @args );
-Notice that the stash will always be empty. This behavior could be configurable
-in the future through an additional switch - for now, this behavior guarantees a
-common interface for all plugins.
+Notice that the stash will be empty by default. This behavior is configurable
+(see below).
+
+=head1 CONFIGURATION
+
+=head2 keep_stash
+
+You can choose to not localize the stash for SubRequests' subinclude calls. The subrequest
+will have the same stash as the request that spawned it. Configure the keep_stash key
+in your view:
+
+ __PACKAGE__->config(
+ subinclude => {
+ 'SubRequest' => {
+ keep_stash => 1,
+ },
+ }
+ );
+
+Note: the stash that the subrequest recieves is a shallow copy of the original stash. That
+means that changes to values of keys on the first level of the stash will be lost when the
+subrequest call returns. Don't count on this behaviour, as it may change in the future.
=cut
parameters and response body. This is necessary to keep behavior consistent
with the other plugins.
+=head1 CONFIGURATION
+
+=head2 keep_stash
+
+You can choose to not localize the stash for Visits' subinclude calls. The subrequest
+will have the same stash as the request that spawned it. Configure the keep_stash key
+in your view:
+
+ __PACKAGE__->config(
+ subinclude => {
+ 'Visit' => {
+ keep_stash => 1,
+ },
+ }
+ );
+
+Note: changes in the stash during a Visit subinclude will be visible after the include
+returns.
+
=cut
has keep_stash => (