.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dancer2::Core::Role::Template 3pm" .TH Dancer2::Core::Role::Template 3pm "2018-12-23" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Dancer2::Core::Role::Template \- Role for template engines .SH "VERSION" .IX Header "VERSION" version 0.207000 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Any class that consumes this role will be able to be used as a template engine under Dancer2. .PP In order to implement this role, the consumer \fBmust\fR implement the method \f(CW\*(C`render\*(C'\fR. This method will receive three arguments: .ie n .IP "$self" 4 .el .IP "\f(CW$self\fR" 4 .IX Item "$self" .PD 0 .ie n .IP "$template" 4 .el .IP "\f(CW$template\fR" 4 .IX Item "$template" .ie n .IP "$tokens" 4 .el .IP "\f(CW$tokens\fR" 4 .IX Item "$tokens" .PD .PP Any template receives the following tokens, by default: .IP "\(bu" 4 \&\f(CW\*(C`perl_version\*(C'\fR .Sp Current version of perl, effectively \f(CW$^V\fR. .IP "\(bu" 4 \&\f(CW\*(C`dancer_version\*(C'\fR .Sp Current version of Dancer2, effectively \f(CW\*(C`Dancer2\->VERSION\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`settings\*(C'\fR .Sp A hash of the application configuration. .IP "\(bu" 4 \&\f(CW\*(C`request\*(C'\fR .Sp The current request object. .IP "\(bu" 4 \&\f(CW\*(C`params\*(C'\fR .Sp A hash reference of all the parameters. .Sp Currently the equivalent of \f(CW\*(C`$request\->params\*(C'\fR. .IP "\(bu" 4 \&\f(CW\*(C`vars\*(C'\fR .Sp The list of request variables, which is what you would get if you called the \f(CW\*(C`vars\*(C'\fR keyword. .IP "\(bu" 4 \&\f(CW\*(C`session\*(C'\fR .Sp The current session data, if a session exists. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "name" .IX Subsection "name" The name of the template engine (e.g.: Simple). .SS "charset" .IX Subsection "charset" The charset. The default value is \fB\s-1UTF\-8\s0\fR. .SS "default_tmpl_ext" .IX Subsection "default_tmpl_ext" The default file extension. If not provided, \fBtt\fR is used. .SS "views" .IX Subsection "views" Path to the directory containing the views. .SS "layout" .IX Subsection "layout" Path to the directory containing the layouts. .SS "layout_dir" .IX Subsection "layout_dir" Relative path to the layout directory. .PP Default: \fBlayouts\fR. .SS "engine" .IX Subsection "engine" Contains the engine. .SH "METHODS" .IX Header "METHODS" .SS "view_pathname($view)" .IX Subsection "view_pathname($view)" Returns the full path to the requested view. .SS "layout_pathname($layout)" .IX Subsection "layout_pathname($layout)" Returns the full path to the requested layout. .SS "pathname_exists($pathname)" .IX Subsection "pathname_exists($pathname)" Returns true if the requested pathname exists. Can be used for either views or layouts: .PP .Vb 2 \& $self\->pathname_exists( $self\->view_pathname( \*(Aqsome_view\*(Aq ) ); \& $self\->pathname_exists( $self\->layout_pathname( \*(Aqsome_layout\*(Aq ) ); .Ve .SS "render_layout($layout, \e%tokens, \e$content)" .IX Subsection "render_layout($layout, %tokens, $content)" Render the layout with the applied tokens .SS "apply_renderer($view, \e%tokens)" .IX Subsection "apply_renderer($view, %tokens)" .SS "apply_layout($content, \e%tokens, \e%options)" .IX Subsection "apply_layout($content, %tokens, %options)" .SS "process($view, \e%tokens, \e%options)" .IX Subsection "process($view, %tokens, %options)" .SH "AUTHOR" .IX Header "AUTHOR" Dancer Core Developers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2018 by Alexis Sukrieh. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.