.\" Automatically generated by Pod::Man 4.09 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Catalyst::View::Component::SubInclude 3pm" .TH Catalyst::View::Component::SubInclude 3pm "2017-08-02" "perl v5.26.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::View::Component::SubInclude \- Use subincludes in your Catalyst views .SH "VERSION" .IX Header "VERSION" Version 0.10 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& package MyApp::View::TT; \& use Moose; \& \& extends \*(AqCatalyst::View::TT\*(Aq; \& with \*(AqCatalyst::View::Component::SubInclude\*(Aq; \& \& _\|_PACKAGE_\|_\->config( subinclude_plugin => \*(AqSubRequest\*(Aq ); .Ve .PP Then, somewhere in your templates: .PP .Vb 2 \& [% subinclude(\*(Aq/my/widget\*(Aq) %] \& [% subinclude_using(\*(AqSubRequest\*(Aq, \*(Aq/page/footer\*(Aq) %] .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Catalyst::View::Component::SubInclude\*(C'\fR allows you to include content in your templates (or, more generally, somewhere in your view's \f(CW\*(C`render\*(C'\fR processing) which comes from another action in your application. It's implemented as a Moose::Role, so using Moose in your view is required. .PP Simply put, it's a way to include the output of a Catalyst sub-request somewhere in your page. .PP It's built in an extensible way so that you're free to use sub-requests, Varnish \s-1ESI\s0 () or any other sub-include plugin you might want to implement. .SH "STASH FUNCTIONS" .IX Header "STASH FUNCTIONS" This component does its magic by exporting a \f(CW\*(C`subinclude\*(C'\fR coderef entry to the stash. This way, it's easily accessible by the templates (which is the most common use-case). .ie n .SS """subinclude( $path, @args )""" .el .SS "\f(CWsubinclude( $path, @args )\fP" .IX Subsection "subinclude( $path, @args )" This will render and return the body of the included resource (as specified by \&\f(CW$path\fR) using the default subinclude plugin. .ie n .SS """subinclude_using( $plugin, $path, @args )""" .el .SS "\f(CWsubinclude_using( $plugin, $path, @args )\fP" .IX Subsection "subinclude_using( $plugin, $path, @args )" This will render and return the body of the included resource (as specified by \&\f(CW$path\fR) using the specified subinclude plugin. .PP The \f(CW\*(C`subinclude\*(C'\fR function above is implemented basically as a shortcut which calls this function using the default plugin as the first parameter. .SH "SUBINCLUDE PLUGINS" .IX Header "SUBINCLUDE PLUGINS" The module comes with two subinclude plugins: SubRequest, Visit and \&\s-1ESI\s0. .PP By default, the \f(CW\*(C`SubRequest\*(C'\fR plugin will be used. This can be changed in the view's configuration options (either in the config file or in the view module itself). .PP Configuration file example: .PP .Vb 3 \& \& subinclude_plugin ESI \& .Ve .ie n .SS """set_subinclude_plugin( $plugin )""" .el .SS "\f(CWset_subinclude_plugin( $plugin )\fP" .IX Subsection "set_subinclude_plugin( $plugin )" This method changes the current active subinclude plugin in runtime. It expects the plugin suffix (e.g. \f(CW\*(C`ESI\*(C'\fR or \f(CW\*(C`SubRequest\*(C'\fR) or a fully-qualified class name in the \f(CW\*(C`Catalyst::View::Component::SubInclude\*(C'\fR namespace. .SS "Writing plugins" .IX Subsection "Writing plugins" If writing your own plugin, keep in kind plugins are required to implement a class method \f(CW\*(C`generate_subinclude\*(C'\fR with the following signature: .PP .Vb 3 \& sub generate_subinclude { \& my ($class, $c, @args) = @_; \& } .Ve .PP The default plugin is stored in the \f(CW\*(C`subinclude_plugin\*(C'\fR which can be changed in runtime. It expects a fully qualified class name. .SH "SEE ALSO" .IX Header "SEE ALSO" Catalyst::Plugin::SubRequest, Moose::Role, Moose, .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \&\f(CW\*(C`bug\-catalyst\-view\-component\-subinclude at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "AUTHOR" .IX Header "AUTHOR" Nilson Santos Figueiredo Junior, \f(CW\*(C`\*(C'\fR .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Tomas Doran (t0m) \f(CW\*(C`\*(C'\fR. .PP Wallace Reis (wreis) \f(CW\*(C`\*(C'\fR. .SH "SPONSORSHIP" .IX Header "SPONSORSHIP" Development sponsored by Ionzero \s-1LLC\s0 . .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright (C) 2010 Nilson Santos Figueiredo Junior and the above contributors. .PP Copyright (C) 2009 Nilson Santos Figueiredo Junior. .PP Copyright (C) 2009 Ionzero \s-1LLC.\s0 .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.