1Dancer2::Core::Role::TeUmspelratCeo(n3t)ributed Perl DocDuamnecnetra2t:i:oCnore::Role::Template(3)
2
3
4

NAME

6       Dancer2::Core::Role::Template - Role for template engines
7

VERSION

9       version 0.300004
10

DESCRIPTION

12       Any class that consumes this role will be able to be used as a template
13       engine under Dancer2.
14
15       In order to implement this role, the consumer must implement the method
16       "render". This method will receive three arguments:
17
18       $self
19       $template
20       $tokens
21
22       Any template receives the following tokens, by default:
23
24       ·   "perl_version"
25
26           Current version of perl, effectively $^V.
27
28       ·   "dancer_version"
29
30           Current version of Dancer2, effectively "Dancer2->VERSION".
31
32       ·   "settings"
33
34           A hash of the application configuration.
35
36       ·   "request"
37
38           The current request object.
39
40       ·   "params"
41
42           A hash reference of all the parameters.
43
44           Currently the equivalent of "$request->params".
45
46       ·   "vars"
47
48           The list of request variables, which is what you would get if you
49           called the "vars" keyword.
50
51       ·   "session"
52
53           The current session data, if a session exists.
54

ATTRIBUTES

56   name
57       The name of the template engine (e.g.: Simple).
58
59   charset
60       The charset.  The default value is UTF-8.
61
62   default_tmpl_ext
63       The default file extension.  If not provided, tt is used.
64
65   views
66       Path to the directory containing the views.
67
68   layout
69       Path to the directory containing the layouts.
70
71   layout_dir
72       Relative path to the layout directory.
73
74       Default: layouts.
75
76   engine
77       Contains the engine.
78

METHODS

80   view_pathname($view)
81       Returns the full path to the requested view.
82
83   layout_pathname($layout)
84       Returns the full path to the requested layout.
85
86   pathname_exists($pathname)
87       Returns true if the requested pathname exists. Can be used for either
88       views or layouts:
89
90           $self->pathname_exists( $self->view_pathname( 'some_view' ) );
91           $self->pathname_exists( $self->layout_pathname( 'some_layout' ) );
92
93   render_layout($layout, \%tokens, \$content)
94       Render the layout with the applied tokens
95
96   apply_renderer($view, \%tokens)
97   apply_layout($content, \%tokens, \%options)
98   process($view, \%tokens, \%options)

AUTHOR

100       Dancer Core Developers
101
103       This software is copyright (c) 2020 by Alexis Sukrieh.
104
105       This is free software; you can redistribute it and/or modify it under
106       the same terms as the Perl 5 programming language system itself.
107
108
109
110perl v5.32.0                      2020-07-28  Dancer2::Core::Role::Template(3)
Impressum