File: README

package info (click to toggle)
libcatalyst-view-component-subinclude-perl 0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 304 kB
  • ctags: 205
  • sloc: perl: 2,591; makefile: 5
file content (118 lines) | stat: -rw-r--r-- 3,948 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
NAME
    Catalyst::View::Component::SubInclude - Use subincludes in your Catalyst
    views

VERSION
    Version 0.10

SYNOPSIS
      package MyApp::View::TT;
      use Moose;

      extends 'Catalyst::View::TT';
      with 'Catalyst::View::Component::SubInclude';

      __PACKAGE__->config( subinclude_plugin => 'SubRequest' );

    Then, somewhere in your templates:

      [% subinclude('/my/widget') %]
      [% subinclude_using('SubRequest', '/page/footer') %]

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.

  "subinclude_using( $plugin, $path, @args )"
    This will render and return the body of the included resource (as
    specified by $path) using the specified subinclude plugin.

    The "subinclude" function above is implemented basically as a shortcut
    which calls this function using the default plugin as the first
    parameter.

SUBINCLUDE PLUGINS
    The module comes with two subinclude plugins: SubRequest, Visit and ESI.

    By default, the "SubRequest" plugin will be used. This can be changed in
    the view's configuration options (either in the config file or in the
    view module itself).

    Configuration file example:

      <View::TT>
          subinclude_plugin   ESI
      </View::TT>

  "set_subinclude_plugin( $plugin )"
    This method changes the current active subinclude plugin in runtime. It
    expects the plugin suffix (e.g. "ESI" or "SubRequest") or a
    fully-qualified class name in the
    "Catalyst::View::Component::SubInclude" namespace.

  Writing plugins
    If writing your own plugin, keep in kind plugins are required to
    implement a class method "generate_subinclude" with the following
    signature:

      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
    Nilson Santos Figueiredo Junior, "<nilsonsfj at cpan.org>"

CONTRIBUTORS
    Tomas Doran (t0m) "<bobtfish@bobtfish.net".

    Vladimir Timofeev, "<vovkasm at gmail.com>".

    Wallace Reis (wreis) "<wreis@cpan.org>".

SPONSORSHIP
    Development sponsored by Ionzero LLC <http://www.ionzero.com/>.

COPYRIGHT & LICENSE
    Copyright (C) 2010 Nilson Santos Figueiredo Junior and the above
    contributors.

    Copyright (C) 2009 Nilson Santos Figueiredo Junior.

    Copyright (C) 2009 Ionzero LLC.

    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.