Cot::Plugin::TX - It is a Text::Xslate View module for Cot framework.
use Cot; use Cot::Plugin qw/TX/; get '/' => sub { my $self = shift; $self->res->status(200); $self->res->headers({'Content-Type' => 'text/html', charset => 'utf8'}); my $out = $self->tx->output('index.tmpl',{sample:'hello world!'}); $self->res->body($out); };
Template file must be installed in $ENV{COT_ROOT}/tmpl dir. First argument is templatefile path relative to $ENV{COT_ROOT}/tmpl. Second argument is parameters. After arguments is Text::Xslate options.
my $out = $self->tx->output('index.tmpl', {sample:'hello world!'}, syntax => 'TTerse',);
Copyright (C) Yusuke Shibata
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Yusuke Shibata <shibata@yusukeshibata.jp>
To install Cot::Plugin::TX, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cot::Plugin::TX
CPAN shell
perl -MCPAN -e shell install Cot::Plugin::TX
For more information on module installation, please visit the detailed CPAN module installation guide.