Fix ESI plugin, update Makefile.PL
[catagits/Catalyst-View-Component-SubInclude.git] / lib / Catalyst / View / Component / SubInclude / Visit.pm
CommitLineData
e88af283 1package Catalyst::View::Component::SubInclude::Visit;
2use warnings;
3use strict;
4
5use Carp qw/croak/;
6use namespace::clean qw/croak/;
7
8=head1 NAME
9
10Catalyst::View::Component::SubInclude::Visit - visit() plugin for C::V::Component::SubInclude
11
12=head1 VERSION
13
14Version 0.02
15
16=cut
17
18our $VERSION = '0.02';
19
20=head1 SYNOPSIS
21
22In your view class:
23
24 package MyApp::View::TT;
25 use Moose;
26
27 extends 'Catalyst::View::TT';
28 with 'Catalyst::View::Component::SubInclude';
29
30 __PACKAGE__->config( subinclude_plugin => 'Visit' );
31
32Then, somewhere in your templates:
33
34 [% subinclude('/my/widget') %]
35
36=head1 DESCRIPTION
37
38C<Catalyst::View::Component::SubInclude::Visit> uses C<< $c->visit() >> to
39render subinclude contents.
40
41This method is only supported when using L<Catalyst> version 5.71000 or newer.
42
43=head1 CLASS METHODS
44
45=head2 C<generate_subinclude( $c, $path, @args )>
46
47This will translate to the following call:
48
49 $c->visit( $path, @args );
50
51=cut
52
53sub generate_subinclude {
54 my ($class, $c, $path, @params) = @_;
55
56 croak "subincludes through visit() require Catalyst version 5.71000 or newer"
57 unless $c->can('visit');
58
59 $c->visit( $path, @params );
60 $c->res->{body};
61}
62
63=head1 SEE ALSO
64
65L<Catalyst::View::Component::SubInclude|Catalyst::View::Component::SubInclude>,
66L<Catalyst|Catalyst>
67
68=head1 AUTHOR
69
70Nilson Santos Figueiredo Junior, C<< <nilsonsfj at cpan.org> >>
71
72=head1 SPONSORSHIP
73
74Development sponsored by Ionzero LLC L<http://www.ionzero.com/>.
75
76=head1 COPYRIGHT & LICENSE
77
78Copyright (C) 2009 Nilson Santos Figueiredo Junior.
79
80Copyright (C) 2009 Ionzero LLC.
81
82This program is free software; you can redistribute it and/or modify it
83under the same terms as Perl itself.
84
85=cut
86
871;