1 package Catalyst::View::Component::SubInclude::SubRequest;
6 use namespace::clean qw/croak/;
10 Catalyst::View::Component::SubInclude::SubRequest - Sub-requests plugin for C::V::Component::SubInclude
18 our $VERSION = '0.01';
22 In your application class:
35 package MyApp::View::TT;
38 extends 'Catalyst::View::TT';
39 with 'Catalyst::View::Component::SubInclude';
41 __PACKAGE__->config( subinclude_plugin => 'SubRequest' );
43 Then, somewhere in your templates:
45 [% subinclude('/my/widget') %]
49 C<Catalyst::View::Component::SubInclude::SubRequest> uses Catalyst sub-requests
50 to render the subinclude contents.
52 It requires L<Catalyst::Plugin::SubRequest>.
56 =head2 C<generate_subinclude( $c, $path, @args )>
58 This will translate to the following sub-request call:
60 $c->sub_request( $path, {}, @args );
62 Notice that the stash will always be empty. This behavior could be configurable
63 in the future through an additional switch - for now, this behavior guarantees a
64 common interface for plugins.
68 sub generate_subinclude {
69 my ($class, $c, $path, @params) = @_;
72 croak "subincludes through subrequests require Catalyst::Plugin::SubRequest"
73 unless $c->can('sub_request');
75 $c->sub_request( $path, $stash, @params );
80 L<Catalyst::View::Component::SubInclude|Catalyst::View::Component::SubInclude>,
81 L<Catalyst::Plugin::SubRequest|Catalyst::Plugin::SubRequest>
85 Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
89 Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.
91 =head1 COPYRIGHT & LICENSE
93 Copyright (C) 2009 Nilson Santos Figueiredo Junior.
95 Copyright (C) 2009 Ionzero LLC.
97 This program is free software; you can redistribute it and/or modify it
98 under the same terms as Perl itself.