1 package Catalyst::View::Component::SubInclude::ESI;
7 Catalyst::View::Component::SubInclude::ESI - Edge Side Includes (ESI) plugin for C::V::Component::SubInclude
15 our $VERSION = '0.01';
21 package MyApp::View::TT;
24 extends 'Catalyst::View::TT';
25 with 'Catalyst::View::Component::SubInclude';
27 __PACKAGE__->config( subinclude_plugin => 'ESI' );
29 Then, somewhere in your templates:
31 [% subinclude('/my/widget') %]
35 C<Catalyst::View::Component::SubInclude::ESI> renders C<subinclude> calls as
36 Edge Side Includes (ESI) include directives. This is a feature implemented by
37 Varnish (L<http://varnish.projects.linpro.no/>) which allows cache-efficient
42 =head2 C<generate_subinclude( $c, @args )>
44 This will roughly translate to the following code:
46 my $url = $c->uri_for( @args );
47 return '<!--esi <esi:include src="$url" /> -->';
49 Notice that the stash will always be empty. This behavior could be configurable
50 in the future through an additional switch - for now, this behavior guarantees a
51 common interface for plugins.
55 sub generate_subinclude {
58 my $url = $c->uri_for( @_ );
59 return '<!--esi <esi:include src="' . $url->path . '" /> -->';
64 L<Catalyst::View::Component::SubInclude|Catalyst::View::Component::SubInclude>,
65 L<http://www.catalystframework.org/calendar/2008/17>,
66 L<http://varnish.projects.linpro.no/>
70 Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
74 Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.
76 =head1 COPYRIGHT & LICENSE
78 Copyright (C) 2009 Nilson Santos Figueiredo Junior.
80 Copyright (C) 2009 Ionzero LLC.
82 This program is free software; you can redistribute it and/or modify it
83 under the same terms as Perl itself.