Catalyst-View-Component-SubInclude
view release on metacpan or search on metacpan
DESCRIPTION
"Catalyst::View::Component::SubInclude" allows you to include content in
your templates (or, more generally, somewhere in your view's "render"
processing) which comes from another action in your application. It's
implemented as a Moose::Role, so using Moose in your view is required.
Simply put, it's a way to include the output of a Catalyst sub-request
somewhere in your page.
It's built in an extensible way so that you're free to use sub-requests,
Varnish ESI (<http://www.catalystframework.org/calendar/2008/17>) or any
other sub-include plugin you might want to implement.
STASH FUNCTIONS
This component does its magic by exporting a "subinclude" coderef entry
to the stash. This way, it's easily accessible by the templates (which
is the most common use-case).
"subinclude( $path, @args )"
This will render and return the body of the included resource (as
specified by $path) using the default subinclude plugin.
sub generate_subinclude {
my ($class, $c, @args) = @_;
}
The default plugin is stored in the "subinclude_plugin" which can be
changed in runtime. It expects a fully qualified class name.
SEE ALSO
Catalyst::Plugin::SubRequest, Moose::Role, Moose,
<http://www.catalystframework.org/calendar/2008/17>
BUGS
Please report any bugs or feature requests to
"bug-catalyst-view-component-subinclude at rt.cpan.org", or through the
web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-Component-
SubInclude>. I will be notified, and then you'll automatically be
notified of progress on your bug as I make changes.
AUTHOR
lib/Catalyst/View/Component/SubInclude.pm view on Meta::CPAN
C<Catalyst::View::Component::SubInclude> allows you to include content in your
templates (or, more generally, somewhere in your view's C<render> processing)
which comes from another action in your application. It's implemented as a
L<Moose::Role|Moose::Role>, so using L<Moose|Moose> in your view is required.
Simply put, it's a way to include the output of a Catalyst sub-request somewhere
in your page.
It's built in an extensible way so that you're free to use sub-requests,
Varnish ESI (L<http://www.catalystframework.org/calendar/2008/17>) or any other
sub-include plugin you might want to implement.
=head1 STASH FUNCTIONS
This component does its magic by exporting a C<subinclude> coderef entry to the
stash. This way, it's easily accessible by the templates (which is the most
common use-case).
=head2 C<subinclude( $path, @args )>
lib/Catalyst/View/Component/SubInclude.pm view on Meta::CPAN
Class::MOP::load_class($class);
return $cache->{$class} = $class->new($plugin_config);
}
=head1 SEE ALSO
L<Catalyst::Plugin::SubRequest|Catalyst::Plugin::SubRequest>,
L<Moose::Role|Moose::Role>, L<Moose|Moose>,
L<http://www.catalystframework.org/calendar/2008/17>
=head1 BUGS
Please report any bugs or feature requests to
C<bug-catalyst-view-component-subinclude at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-Component-SubInclude>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
=head1 AUTHOR
lib/Catalyst/View/Component/SubInclude/ESI.pm view on Meta::CPAN
my ($self, $c, $path, @params) = @_;
my $uri = $c->uri_for_action( $path, @params );
return '<!--esi <esi:include src="' . $uri->path_query . '" /> -->';
}
=head1 SEE ALSO
L<Catalyst::View::Component::SubInclude|Catalyst::View::Component::SubInclude>,
L<http://www.catalystframework.org/calendar/2008/17>,
L<http://varnish.projects.linpro.no/>
=head1 AUTHOR
Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
=head1 SPONSORSHIP
Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.
( run in 1.186 second using v1.01-cache-2.11-cpan-39bf76dae61 )