1 package Catalyst::View::Component::SubInclude::SubRequest;
7 Catalyst::View::Component::SubInclude::SubRequest - Sub-requests plugin for C::V::Component::SubInclude
15 our $VERSION = '0.01';
19 In your application class:
32 package MyApp::View::TT;
35 extends 'Catalyst::View::TT';
36 with 'Catalyst::View::Component::SubInclude';
38 __PACKAGE__->config( subinclude_plugin => 'SubRequest' );
40 Then, somewhere in your templates:
42 [% subinclude('/my/widget') %]
46 C<Catalyst::View::Component::SubInclude::SubRequest> uses Catalyst sub-requests
47 to render the subinclude contents.
49 It requires L<Catalyst::Plugin::SubRequest>.
53 =head2 C<subinclude( $path, @args )>
55 This will translate to the following sub-request call:
57 $c->sub_request( $path, {}, @args );
59 Notice that the stash will always be empty. This behavior could be configurable
60 in the future through an additional switch - for now, this behavior guarantees a
61 common interface for plugins.
65 sub generate_subinclude {
66 my ($class, $c, $path, @params) = @_;
69 croak "subincludes through subrequests require Catalyst::Plugin::SubRequest"
70 unless $c->can('sub_request');
72 $c->sub_request( $path, $stash, @params );
77 L<Catalyst::View::Component::SubInclude|Catalyst::View::Component::SubInclude>,
78 L<Catalyst::Plugin::SubRequest|Catalyst::Plugin::SubRequest>
82 Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
86 Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.
88 =head1 COPYRIGHT & LICENSE
90 Copyright (C) 2009 Nilson Santos Figueiredo Junior.
92 Copyright (C) 2009 Ionzero LLC.
94 This program is free software; you can redistribute it and/or modify it
95 under the same terms as Perl itself.